Skip to content

Commit 4e5cd9d

Browse files
author
Nelson Vides
committed
Merge branch 'next' into libgit2sharp24
2 parents 11d2e7e + e67b182 commit 4e5cd9d

32 files changed

+263
-227
lines changed

RetailCoder.VBE/App.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,11 @@ public void LogRubberduckStart()
192192
GlobalDiagnosticsContext.Set("RubberduckVersion", version.ToString());
193193
var headers = new List<string>
194194
{
195-
string.Format("\r\n\tRubberduck version {0} loading:", version),
196-
string.Format("\tOperating System: {0} {1}", Environment.OSVersion.VersionString, Environment.Is64BitOperatingSystem ? "x64" : "x86"),
197-
string.Format("\tHost Product: {0} {1}", Application.ProductName, Environment.Is64BitProcess ? "x64" : "x86"),
198-
string.Format("\tHost Version: {0}", Application.ProductVersion),
199-
string.Format("\tHost Executable: {0}", Path.GetFileName(Application.ExecutablePath)),
195+
$"\r\n\tRubberduck version {version} loading:",
196+
$"\tOperating System: {Environment.OSVersion.VersionString} {(Environment.Is64BitOperatingSystem ? "x64" : "x86")}",
197+
$"\tHost Product: {Application.ProductName} {(Environment.Is64BitProcess ? "x64" : "x86")}",
198+
$"\tHost Version: {Application.ProductVersion}",
199+
$"\tHost Executable: {Path.GetFileName(Application.ExecutablePath).ToUpper()}", // .ToUpper() used to convert ExceL.EXE -> EXCEL.EXE
200200
};
201201
LogLevelHelper.SetDebugInfo(string.Join(Environment.NewLine, headers));
202202
}

RetailCoder.VBE/UI/About/AboutControl.xaml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
xmlns:about="clr-namespace:Rubberduck.UI.About"
77
mc:Ignorable="d"
88
d:DesignWidth="499"
9-
d:DataContext="{d:DesignInstance {x:Type about:AboutControlViewModel}, IsDesignTimeCreatable=False}">
9+
d:DataContext="{d:DesignInstance {x:Type about:AboutControlViewModel}, IsDesignTimeCreatable=False}"
10+
KeyDown="OnKeyDownHandler">
1011
<UserControl.Resources>
1112
<BitmapImage x:Key="Ducky" UriSource="../../Resources/AboutBanner.png" />
1213
<BitmapImage x:Key="RD" UriSource="../../Resources/Rubberduck.png" />
@@ -22,10 +23,19 @@
2223
<RowDefinition Height="64" />
2324
</Grid.RowDefinitions>
2425

25-
<Border Grid.Column="0" Grid.Row="0" Background="White" Margin="5,5,0,0">
26-
<TextBlock Margin="5,10,5,10" Text="{Binding Version}" Foreground="Black"
27-
FontWeight="Bold" FontSize="14"
28-
VerticalAlignment="Top" HorizontalAlignment="Left" />
26+
<Border Grid.Column="0" Grid.Row="0" Background="White" Margin="5,5,0,0"
27+
MouseLeftButtonDown="CopyVersionInfo_MouseLeftButtonDown">
28+
<StackPanel>
29+
<TextBlock x:Name="Version"
30+
Margin="5,10,5,0" Text="{Binding Version}" Foreground="Black"
31+
FontWeight="Bold" FontSize="14"
32+
VerticalAlignment="Center" HorizontalAlignment="Center"/>
33+
<Label Name="CopyVersionInfo"
34+
Foreground="Gray"
35+
FontSize="8"
36+
HorizontalAlignment="Center"
37+
Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=AboutWindow_CopyVersionLabel}"/>
38+
</StackPanel>
2939
</Border>
3040

3141
<Border Grid.Column="1" Grid.Row="0" Background="White" Margin="0,5,5,0">

RetailCoder.VBE/UI/About/AboutControl.xaml.cs

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
namespace Rubberduck.UI.About
1+
using System.Windows;
2+
using System.Windows.Input;
3+
using System;
4+
using System.IO;
5+
using Application = System.Windows.Forms.Application;
6+
7+
namespace Rubberduck.UI.About
28
{
39
/// <summary>
410
/// Interaction logic for AboutControl.xaml
@@ -9,5 +15,32 @@ public AboutControl()
915
{
1016
InitializeComponent();
1117
}
18+
19+
private void OnKeyDownHandler(object sender, KeyEventArgs e)
20+
{
21+
bool isControlCPressed = (Keyboard.IsKeyDown(Key.C) && (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)));
22+
if (isControlCPressed)
23+
{
24+
CopyVersionInfoToClipboard();
25+
}
26+
}
27+
28+
private void CopyVersionInfo_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
29+
{
30+
CopyVersionInfoToClipboard();
31+
}
32+
33+
private void CopyVersionInfoToClipboard()
34+
{
35+
var sb = new System.Text.StringBuilder();
36+
sb.AppendLine($"Rubberduck version: {this.Version.Text}");
37+
sb.AppendLine($"Operating System: {Environment.OSVersion.VersionString}, {(Environment.Is64BitOperatingSystem ? "x64" : "x86")}");
38+
sb.AppendLine($"Host Product: {Application.ProductName} {(Environment.Is64BitProcess ? "x64" : "x86")}");
39+
sb.AppendLine($"Host Version: {Application.ProductVersion}");
40+
sb.AppendFormat($"Host Executable: {Path.GetFileName(Application.ExecutablePath).ToUpper()}"); // .ToUpper() used to convert ExceL.EXE -> EXCEL.EXE
41+
42+
Clipboard.SetText(sb.ToString());
43+
System.Windows.MessageBox.Show(RubberduckUI.AboutWindow_CopyVersionMessage, RubberduckUI.AboutWindow_CopyVersionCaption);
44+
}
1245
}
1346
}

RetailCoder.VBE/UI/About/AboutControlViewModel.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@ public AboutControlViewModel(IVersionCheck version)
1616
_version = version;
1717
}
1818

19-
public string Version
20-
{
21-
get
22-
{
23-
return string.Format(RubberduckUI.Rubberduck_AboutBuild, _version.CurrentVersion);
24-
}
25-
}
19+
public string Version => string.Format(RubberduckUI.Rubberduck_AboutBuild, _version.CurrentVersion);
2620

2721
private CommandBase _uriCommand;
2822
public CommandBase UriCommand

RetailCoder.VBE/UI/CodeExplorer/CodeExplorerControl.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public CodeExplorerControl()
1515
InitializeComponent();
1616
}
1717

18-
private CodeExplorerViewModel ViewModel { get { return DataContext as CodeExplorerViewModel; } }
18+
private CodeExplorerViewModel ViewModel => DataContext as CodeExplorerViewModel;
1919

2020
private void TreeView_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
2121
{

RetailCoder.VBE/UI/CodeExplorer/Commands/AddComponentCommand.cs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,17 @@ private Declaration GetDeclaration(CodeExplorerItemViewModel node)
5252

5353
private string GetFolder(CodeExplorerItemViewModel node)
5454
{
55-
if (node == null)
55+
switch (node)
5656
{
57-
return DefaultFolder;
57+
case null:
58+
return DefaultFolder;
59+
case ICodeExplorerDeclarationViewModel declarationNode:
60+
return string.IsNullOrEmpty(declarationNode.Declaration.CustomFolder)
61+
? DefaultFolder
62+
: declarationNode.Declaration.CustomFolder.Replace("\"", string.Empty);
63+
default:
64+
return ((CodeExplorerCustomFolderViewModel)node).FullPath;
5865
}
59-
60-
var declarationNode = node as ICodeExplorerDeclarationViewModel;
61-
if (declarationNode != null)
62-
{
63-
return string.IsNullOrEmpty(declarationNode.Declaration.CustomFolder)
64-
? DefaultFolder
65-
: declarationNode.Declaration.CustomFolder.Replace("\"", string.Empty);
66-
}
67-
68-
return ((CodeExplorerCustomFolderViewModel)node).FullPath;
6966
}
7067
}
7168
}

RetailCoder.VBE/UI/Controls/BindableSelectedItemBehavior.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ public class BindableSelectedItemBehavior : Behavior<TreeView>
1111
{
1212
public object SelectedItem
1313
{
14-
get { return (object) GetValue(SelectedItemProperty); }
15-
set { SetValue(SelectedItemProperty, value); }
14+
get => (object) GetValue(SelectedItemProperty);
15+
set => SetValue(SelectedItemProperty, value);
1616
}
1717

1818
public static readonly DependencyProperty SelectedItemProperty =
@@ -21,8 +21,7 @@ public object SelectedItem
2121

2222
private static void OnSelectedItemChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
2323
{
24-
var item = e.NewValue as TreeViewItem;
25-
if (item != null)
24+
if (e.NewValue is TreeViewItem item)
2625
{
2726
item.SetValue(TreeViewItem.IsSelectedProperty, true);
2827
}

RetailCoder.VBE/UI/Controls/BindableTextEditor.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public BindableTextEditor()
3131

3232
public new string Text
3333
{
34-
get { return base.Text; }
35-
set { base.Text = value; }
34+
get => base.Text;
35+
set => base.Text = value;
3636
}
3737

3838
public static readonly DependencyProperty TextProperty =
@@ -50,10 +50,7 @@ protected override void OnTextChanged(EventArgs e)
5050

5151
public void RaisePropertyChanged(string property)
5252
{
53-
if (PropertyChanged != null)
54-
{
55-
PropertyChanged(this, new PropertyChangedEventArgs(property));
56-
}
53+
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
5754
}
5855

5956
public event PropertyChangedEventHandler PropertyChanged;

RetailCoder.VBE/UI/Controls/DeclarationTypeToStringConverter.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ public class DeclarationTypeToStringConverter : IValueConverter
99
{
1010
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
1111
{
12-
if (value is DeclarationType)
12+
if (value is DeclarationType type)
1313
{
14-
var type = (DeclarationType)value;
1514
var text = RubberduckUI.ResourceManager.GetString("DeclarationType_" + type, CultureInfo.CurrentUICulture) ?? string.Empty;
1615
return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(text);
1716
}

RetailCoder.VBE/UI/Controls/EmptyUIRefresh.xaml.cs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
using System.Windows;
7-
using System.Windows.Controls;
8-
using System.Windows.Data;
9-
using System.Windows.Documents;
10-
using System.Windows.Input;
11-
using System.Windows.Media;
12-
using System.Windows.Media.Imaging;
13-
using System.Windows.Navigation;
14-
using System.Windows.Shapes;
1+
using System.Windows.Controls;
152

163
namespace Rubberduck.UI.Controls
174
{

0 commit comments

Comments
 (0)