diff --git a/RetailCoder.VBE/App.cs b/RetailCoder.VBE/App.cs index bf4c750b68..923f62c023 100644 --- a/RetailCoder.VBE/App.cs +++ b/RetailCoder.VBE/App.cs @@ -192,11 +192,11 @@ public void LogRubberduckStart() GlobalDiagnosticsContext.Set("RubberduckVersion", version.ToString()); var headers = new List { - string.Format("\r\n\tRubberduck version {0} loading:", version), - string.Format("\tOperating System: {0} {1}", Environment.OSVersion.VersionString, Environment.Is64BitOperatingSystem ? "x64" : "x86"), - string.Format("\tHost Product: {0} {1}", Application.ProductName, Environment.Is64BitProcess ? "x64" : "x86"), - string.Format("\tHost Version: {0}", Application.ProductVersion), - string.Format("\tHost Executable: {0}", Path.GetFileName(Application.ExecutablePath)), + $"\r\n\tRubberduck version {version} loading:", + $"\tOperating System: {Environment.OSVersion.VersionString} {(Environment.Is64BitOperatingSystem ? "x64" : "x86")}", + $"\tHost Product: {Application.ProductName} {(Environment.Is64BitProcess ? "x64" : "x86")}", + $"\tHost Version: {Application.ProductVersion}", + $"\tHost Executable: {Path.GetFileName(Application.ExecutablePath).ToUpper()}", // .ToUpper() used to convert ExceL.EXE -> EXCEL.EXE }; LogLevelHelper.SetDebugInfo(string.Join(Environment.NewLine, headers)); } diff --git a/RetailCoder.VBE/UI/About/AboutControl.xaml b/RetailCoder.VBE/UI/About/AboutControl.xaml index aaf054c765..355c53daab 100644 --- a/RetailCoder.VBE/UI/About/AboutControl.xaml +++ b/RetailCoder.VBE/UI/About/AboutControl.xaml @@ -6,7 +6,8 @@ xmlns:about="clr-namespace:Rubberduck.UI.About" mc:Ignorable="d" d:DesignWidth="499" - d:DataContext="{d:DesignInstance {x:Type about:AboutControlViewModel}, IsDesignTimeCreatable=False}"> + d:DataContext="{d:DesignInstance {x:Type about:AboutControlViewModel}, IsDesignTimeCreatable=False}" + KeyDown="OnKeyDownHandler"> @@ -22,10 +23,19 @@ - - + + + + diff --git a/RetailCoder.VBE/UI/About/AboutControl.xaml.cs b/RetailCoder.VBE/UI/About/AboutControl.xaml.cs index 39059118b4..3b4ce980a8 100644 --- a/RetailCoder.VBE/UI/About/AboutControl.xaml.cs +++ b/RetailCoder.VBE/UI/About/AboutControl.xaml.cs @@ -1,4 +1,10 @@ -namespace Rubberduck.UI.About +using System.Windows; +using System.Windows.Input; +using System; +using System.IO; +using Application = System.Windows.Forms.Application; + +namespace Rubberduck.UI.About { /// /// Interaction logic for AboutControl.xaml @@ -9,5 +15,32 @@ public AboutControl() { InitializeComponent(); } + + private void OnKeyDownHandler(object sender, KeyEventArgs e) + { + bool isControlCPressed = (Keyboard.IsKeyDown(Key.C) && (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))); + if (isControlCPressed) + { + CopyVersionInfoToClipboard(); + } + } + + private void CopyVersionInfo_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + CopyVersionInfoToClipboard(); + } + + private void CopyVersionInfoToClipboard() + { + var sb = new System.Text.StringBuilder(); + sb.AppendLine($"Rubberduck version: {this.Version.Text}"); + sb.AppendLine($"Operating System: {Environment.OSVersion.VersionString}, {(Environment.Is64BitOperatingSystem ? "x64" : "x86")}"); + sb.AppendLine($"Host Product: {Application.ProductName} {(Environment.Is64BitProcess ? "x64" : "x86")}"); + sb.AppendLine($"Host Version: {Application.ProductVersion}"); + sb.AppendFormat($"Host Executable: {Path.GetFileName(Application.ExecutablePath).ToUpper()}"); // .ToUpper() used to convert ExceL.EXE -> EXCEL.EXE + + Clipboard.SetText(sb.ToString()); + System.Windows.MessageBox.Show(RubberduckUI.AboutWindow_CopyVersionMessage, RubberduckUI.AboutWindow_CopyVersionCaption); + } } } diff --git a/RetailCoder.VBE/UI/RubberduckUI.Designer.cs b/RetailCoder.VBE/UI/RubberduckUI.Designer.cs index 130af82036..29651e8e06 100644 --- a/RetailCoder.VBE/UI/RubberduckUI.Designer.cs +++ b/RetailCoder.VBE/UI/RubberduckUI.Designer.cs @@ -129,6 +129,33 @@ public class RubberduckUI { } } + /// + /// Looks up a localized string similar to Copy successful. + /// + public static string AboutWindow_CopyVersionCaption { + get { + return ResourceManager.GetString("AboutWindow_CopyVersionCaption", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Click here to copy version info to clipboard.. + /// + public static string AboutWindow_CopyVersionLabel { + get { + return ResourceManager.GetString("AboutWindow_CopyVersionLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Version information copied to clipboard.. + /// + public static string AboutWindow_CopyVersionMessage { + get { + return ResourceManager.GetString("AboutWindow_CopyVersionMessage", resourceCulture); + } + } + /// /// Looks up a localized string similar to All contributors to our GitHub repository ///All our stargazers, likers & followers, for the warm fuzzies @@ -5411,7 +5438,7 @@ public class RubberduckUI { } /// - /// Looks up a localized string similar to Rubberduck ToDo Items - {0} + /// Looks up a localized string similar to Rubberduck TODO Items - {0} ///{1} items found.. /// public static string ToDoExplorer_NumberOfIssuesFound_Plural { @@ -5421,7 +5448,7 @@ public class RubberduckUI { } /// - /// Looks up a localized string similar to Rubberduck ToDo Items - {0} + /// Looks up a localized string similar to Rubberduck TODO Items - {0} ///{1} items found.. /// public static string ToDoExplorer_NumberOfIssuesFound_Singular { diff --git a/RetailCoder.VBE/UI/RubberduckUI.resx b/RetailCoder.VBE/UI/RubberduckUI.resx index 7f3370cdf1..8299887280 100644 --- a/RetailCoder.VBE/UI/RubberduckUI.resx +++ b/RetailCoder.VBE/UI/RubberduckUI.resx @@ -1,4 +1,4 @@ - + - + @@ -2122,4 +2122,13 @@ Would you like to import them to Rubberduck? Copy to clipboard - + + Copy successful + + + Click here to copy version info to clipboard. + + + Version information copied to clipboard. + + \ No newline at end of file