Skip to content

Commit 2ae7fe8

Browse files
authored
Merge pull request #3851 from IvenBach/FixAboutControl
Add host information in About dialog
2 parents 3fe4074 + deca102 commit 2ae7fe8

File tree

5 files changed

+88
-14
lines changed

5 files changed

+88
-14
lines changed

Rubberduck.Core/UI/About/AboutControl.xaml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<ColumnDefinition />
1919
</Grid.ColumnDefinitions>
2020
<Grid.RowDefinitions>
21-
<RowDefinition Height="64" />
21+
<RowDefinition Height="75" />
2222
<RowDefinition Height="Auto" MinHeight="250" />
2323
<RowDefinition Height="64" />
2424
</Grid.RowDefinitions>
@@ -27,8 +27,24 @@
2727
MouseLeftButtonDown="CopyVersionInfo_MouseLeftButtonDown">
2828
<StackPanel>
2929
<TextBlock x:Name="Version"
30-
Margin="5,10,5,0" Text="{Binding Version}" Foreground="Black"
31-
FontWeight="Bold" FontSize="14"
30+
Margin="0,5" Text="{Binding Version}" Foreground="Black"
31+
FontWeight="Bold" FontSize="10"
32+
VerticalAlignment="Center" HorizontalAlignment="Center"/>
33+
<TextBlock x:Name="OperatingSystem"
34+
Margin="0" Text="{Binding OperatingSystem}" Foreground="Black"
35+
FontWeight="Bold" FontSize="8"
36+
VerticalAlignment="Center" HorizontalAlignment="Center"/>
37+
<TextBlock x:Name="HostProduct"
38+
Margin="0" Text="{Binding HostProduct}" Foreground="Black"
39+
FontWeight="Bold" FontSize="8"
40+
VerticalAlignment="Center" HorizontalAlignment="Center"/>
41+
<TextBlock x:Name="HostVersion"
42+
Margin="0" Text="{Binding HostVersion}" Foreground="Black"
43+
FontWeight="Bold" FontSize="8"
44+
VerticalAlignment="Center" HorizontalAlignment="Center"/>
45+
<TextBlock x:Name="HostExecutable"
46+
Margin="0" Text="{Binding HostExecutable}" Foreground="Black"
47+
FontWeight="Bold" FontSize="8"
3248
VerticalAlignment="Center" HorizontalAlignment="Center"/>
3349
<Label Name="CopyVersionInfo"
3450
Foreground="Gray"
@@ -47,7 +63,7 @@
4763
HorizontalAlignment="Left"
4864
VerticalAlignment="Top"
4965
Margin="5,0,0,5" Height="316" Width="175">
50-
<Image Source="{StaticResource Ducky}" Stretch="UniformToFill" Height="250" />
66+
<Image Source="{StaticResource Ducky}" Stretch="UniformToFill" Height="250" HorizontalAlignment="Center"/>
5167
<TextBlock HorizontalAlignment="Center" Margin="0,30,0,0">
5268
<Hyperlink Name="WebpageHyperlink"
5369
NavigateUri="http://rubberduckvba.com/"
@@ -65,7 +81,7 @@
6581
<StackPanel Grid.Column="1"
6682
Grid.Row="1"
6783
Background="White"
68-
Margin="0,0,5,5"
84+
Margin="0,0,5,25"
6985
Grid.RowSpan="2">
7086

7187
<Label Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=AboutWindow_AttributionsLabel}"
@@ -184,7 +200,7 @@ Wayne Phillips (vbWatchdog)
184200
</Border>
185201
<TextBlock Grid.Row="2" Grid.Column="1"
186202
Text="{Binding AboutCopyright}"
187-
FontSize="8" Margin="10"
203+
FontSize="8" Margin="15"
188204
VerticalAlignment="Bottom" HorizontalAlignment="Center" Height="11" Width="237" />
189205
</Grid>
190206
</UserControl>

Rubberduck.Core/UI/About/AboutControl.xaml.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
using System.Windows;
22
using System.Windows.Input;
3-
using System;
4-
using System.IO;
5-
using Application = System.Windows.Forms.Application;
63

74
namespace Rubberduck.UI.About
85
{
@@ -33,11 +30,11 @@ private void CopyVersionInfo_MouseLeftButtonDown(object sender, MouseButtonEvent
3330
private void CopyVersionInfoToClipboard()
3431
{
3532
var sb = new System.Text.StringBuilder();
36-
sb.AppendLine($"Rubberduck version: {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
33+
sb.AppendLine(Version.Text);
34+
sb.AppendLine(OperatingSystem.Text);
35+
sb.AppendLine(HostProduct.Text);
36+
sb.AppendLine(HostVersion.Text);
37+
sb.AppendLine(HostExecutable.Text);
4138

4239
Clipboard.SetText(sb.ToString());
4340
System.Windows.MessageBox.Show(RubberduckUI.AboutWindow_CopyVersionMessage, RubberduckUI.AboutWindow_CopyVersionCaption);

Rubberduck.Core/UI/About/AboutControlViewModel.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using NLog;
44
using Rubberduck.UI.Command;
55
using Rubberduck.VersionCheck;
6+
using Application = System.Windows.Forms.Application;
7+
using System.IO;
68

79
namespace Rubberduck.UI.About
810
{
@@ -17,6 +19,17 @@ public AboutControlViewModel(IVersionCheck version)
1719

1820
public string Version => string.Format(RubberduckUI.Rubberduck_AboutBuild, _version.CurrentVersion);
1921

22+
public string OperatingSystem =>
23+
string.Format(RubberduckUI.AboutWindow_OperatingSystem, Environment.OSVersion.VersionString, Environment.Is64BitOperatingSystem ? "x64" : "x86");
24+
25+
public string HostProduct =>
26+
string.Format(RubberduckUI.AboutWindow_HostProduct, Application.ProductName, Environment.Is64BitProcess ? "x64" : "x86");
27+
28+
public string HostVersion => string.Format(RubberduckUI.AboutWindow_HostVersion, Application.ProductVersion);
29+
30+
public string HostExecutable => string.Format(RubberduckUI.AboutWindow_HostExecutable,
31+
Path.GetFileName(Application.ExecutablePath).ToUpper()); // .ToUpper() used to convert ExceL.EXE -> EXCEL.EXE
32+
2033
private CommandBase _uriCommand;
2134
public CommandBase UriCommand
2235
{

Rubberduck.Core/UI/RubberduckUI.Designer.cs

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Rubberduck.Core/UI/RubberduckUI.resx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,6 +1809,18 @@ NOTE: Restart is required for the setting to take effect.</value>
18091809
<data name="GeneralSettings_CompileBeforeParse_WarnCompileOnDemandEnabled_Caption" xml:space="preserve">
18101810
<value>Compile On Demand currently enabled</value>
18111811
</data>
1812+
<data name="AboutWindow_HostExecutable" xml:space="preserve">
1813+
<value>Host Executable: {0}</value>
1814+
</data>
1815+
<data name="AboutWindow_HostProduct" xml:space="preserve">
1816+
<value>Host Product: {0} {1}</value>
1817+
</data>
1818+
<data name="AboutWindow_HostVersion" xml:space="preserve">
1819+
<value>Host Version: {0}</value>
1820+
</data>
1821+
<data name="AboutWindow_OperatingSystem" xml:space="preserve">
1822+
<value>OS: {0}, {1}</value>
1823+
</data>
18121824
<data name="Command_AddTestModule_Error" xml:space="preserve">
18131825
<value>Unable to create test module. The host application may not allow for creation of new modules or the project may be locked. For details, check the log.</value>
18141826
</data>

0 commit comments

Comments
 (0)