Skip to content

Commit cac66f5

Browse files
committed
Add view log in explorer option. Ref #4797
This also modifies the copyright year in the bottom label so that it automatically updates.
1 parent 1e3e615 commit cac66f5

File tree

10 files changed

+77
-21
lines changed

10 files changed

+77
-21
lines changed

Rubberduck.Core/UI/About/AboutControl.xaml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,22 @@
7777
<Border Grid.Row="1" Grid.Column="0" Style="{StaticResource SectionBorder}">
7878
<StackPanel Grid.Column="0" Grid.Row="1"
7979
MinHeight="100" MinWidth="250"
80-
VerticalAlignment="Center"
81-
MouseLeftButtonDown="CopyVersionInfo_MouseLeftButtonDown" >
80+
VerticalAlignment="Center">
8281
<TextBlock x:Name="Version" Text="{Binding Version}" Style="{StaticResource HeadingLabel}" HorizontalAlignment="Center" Margin="5" />
8382
<TextBlock x:Name="OperatingSystem" Text="{Binding OperatingSystem}" Style="{StaticResource NormalLabel}" HorizontalAlignment="Center"/>
8483
<TextBlock x:Name="HostProduct" Text="{Binding HostProduct}" Style="{StaticResource NormalLabel}" HorizontalAlignment="Center"/>
8584
<TextBlock x:Name="HostVersion" Text="{Binding HostVersion}" Style="{StaticResource NormalLabel}" HorizontalAlignment="Center"/>
8685
<TextBlock x:Name="HostExecutable" Text="{Binding HostExecutable}" Style="{StaticResource NormalLabel}" HorizontalAlignment="Center"/>
87-
<TextBlock Text="{Resx ResxName=Rubberduck.Resources.About.AboutUI, Key=AboutWindow_CopyVersionLabel}"
88-
Style="{StaticResource SubtleLabel}" HorizontalAlignment="Center" Margin="5,10"/>
86+
<TextBlock Style="{StaticResource SubtleLabel}" HorizontalAlignment="Center" Margin="5,10,5,2">
87+
<Hyperlink Click="CopyVersionInfo_Click">
88+
<Run Text="{Resx ResxName=Rubberduck.Resources.About.AboutUI, Key=AboutWindow_CopyVersionLabel}"/>
89+
</Hyperlink>
90+
</TextBlock>
91+
<TextBlock Style="{StaticResource SubtleLabel}" HorizontalAlignment="Center" Margin="5,2,5,10" >
92+
<Hyperlink Command="{Binding ViewLogCommand}">
93+
<Run Text="{Resx ResxName=Rubberduck.Resources.About.AboutUI, Key=AboutWindow_ViewLogLabel}"/>
94+
</Hyperlink>
95+
</TextBlock>
8996
</StackPanel>
9097
</Border>
9198
<Border Grid.Row="2" Grid.Column="0" Style="{StaticResource SectionBorder}">
@@ -99,7 +106,7 @@
99106
<Border Style="{StaticResource ReportButtonBorder}">
100107
<TextBlock>
101108
<Hyperlink Name="GitHubIssueUrl"
102-
NavigateUri="https://github.com/rubberduck-vba/Rubberduck/issues/new"
109+
NavigateUri="https://github.com/rubberduck-vba/Rubberduck/issues/new/choose"
103110
TextDecorations="{x:Null}"
104111
Command="{Binding UriCommand}" CommandParameter="{Binding ElementName=GitHubIssueUrl, Path=NavigateUri}">
105112
<Label Height="40" Foreground="White" FontFamily="Segoe UI" FontSize="13" FontWeight="SemiBold"
@@ -151,7 +158,7 @@
151158
</TextBlock>
152159
</Border>
153160
<Border Grid.Row="1" Grid.Column="1" Grid.RowSpan="2" Style="{StaticResource SectionBorder}">
154-
<ScrollViewer Margin="5" Height="350" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Visible">
161+
<ScrollViewer Margin="5" Height="360" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Visible">
155162
<StackPanel VerticalAlignment="Top">
156163
<TextBlock Text="{Resx ResxName=Rubberduck.Resources.About.AboutUI, Key=AboutWindow_AttributionsLabel}"
157164
Style="{StaticResource HeadingLabel}" />

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private void OnKeyDownHandler(object sender, KeyEventArgs e)
2323
}
2424
}
2525

26-
private void CopyVersionInfo_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
26+
private void CopyVersionInfo_Click(object sender, RoutedEventArgs e)
2727
{
2828
CopyVersionInfoToClipboard();
2929
}

Rubberduck.Core/UI/About/AboutControlViewModel.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
namespace Rubberduck.UI.About
1111
{
12+
using NLog.Targets;
13+
1214
public class AboutControlViewModel
1315
{
1416
private readonly IVersionCheck _version;
@@ -30,7 +32,7 @@ public AboutControlViewModel(IVersionCheck version)
3032

3133
public string HostExecutable => string.Format(AboutUI.AboutWindow_HostExecutable,
3234
Path.GetFileName(Application.ExecutablePath).ToUpper()); // .ToUpper() used to convert ExceL.EXE -> EXCEL.EXE
33-
35+
3436
private CommandBase _uriCommand;
3537
public CommandBase UriCommand
3638
{
@@ -47,6 +49,29 @@ public CommandBase UriCommand
4749
}
4850
}
4951

52+
private CommandBase _viewLogCommand;
53+
public CommandBase ViewLogCommand
54+
{
55+
get
56+
{
57+
if (_viewLogCommand != null)
58+
{
59+
return _viewLogCommand;
60+
}
61+
return _viewLogCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ =>
62+
{
63+
var fileTarget = (FileTarget) LogManager.Configuration.FindTargetByName("file");
64+
65+
var logEventInfo = new LogEventInfo { TimeStamp = DateTime.Now };
66+
var fileName = fileTarget.FileName.Render(logEventInfo);
67+
68+
// The /select argument will only work if the path has backslashes
69+
fileName = fileName.Replace("/", "\\");
70+
Process.Start(new ProcessStartInfo("explorer.exe", $"/select, \"{fileName}\""));
71+
});
72+
}
73+
}
74+
5075
public string AboutCopyright =>
5176
string.Format(AboutUI.AboutWindow_Copyright, DateTime.Now.Year);
5277
}

Rubberduck.Core/UI/About/AboutDialog.Designer.cs

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

Rubberduck.Resources/About/AboutUI.Designer.cs

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

Rubberduck.Resources/About/AboutUI.cs.resx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
<value>O Rubberducku</value>
125125
</data>
126126
<data name="AboutWindow_Copyright" xml:space="preserve">
127-
<value>© Copyright 2014-2018 Rubberduck project contributors</value>
127+
<value>© Copyright 2014-{0} Rubberduck project contributors</value>
128128
</data>
129129
<data name="AboutWindow_SpecialThanksLabel" xml:space="preserve">
130130
<value>Speciální Poděkování</value>
@@ -185,4 +185,7 @@ Všichni ti, co koukají na hvězdy, oblíbenci a následovníci,, pro ten tepl
185185
<data name="AboutWindow_ReportAnIssue" xml:space="preserve">
186186
<value>Nahlásit problém</value>
187187
</data>
188-
</root>
188+
<data name="AboutWindow_ViewLogLabel" xml:space="preserve">
189+
<value>Zobrazit protokol Průzkumník souborů</value>
190+
</data>
191+
</root>

Rubberduck.Resources/About/AboutUI.de.resx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
<value>Über Rubberduck</value>
125125
</data>
126126
<data name="AboutWindow_Copyright" xml:space="preserve">
127-
<value>© Copyright 2014-2018 Rubberduck project contributors</value>
127+
<value>© Copyright 2014-{0} Rubberduck project contributors</value>
128128
</data>
129129
<data name="AboutWindow_SpecialThanksLabel" xml:space="preserve">
130130
<value>Spezieller Dank</value>
@@ -185,4 +185,7 @@ Allen Sternguckern, Likern &amp; Followern, für das warme Kribbeln
185185
<data name="AboutWindow_ReportAnIssue" xml:space="preserve">
186186
<value>Einen Fehler melden</value>
187187
</data>
188+
<data name="AboutWindow_ViewLogLabel" xml:space="preserve">
189+
<value>Log-Datei im File Explorer betrachten</value>
190+
</data>
188191
</root>

Rubberduck.Resources/About/AboutUI.es.resx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
<value>Acerca de Rubberduck</value>
125125
</data>
126126
<data name="AboutWindow_Copyright" xml:space="preserve">
127-
<value>© Copyright 2014-2018 contribuyentes al proyecto Rubberduck</value>
127+
<value>© Copyright 2014-{0} contribuyentes al proyecto Rubberduck</value>
128128
</data>
129129
<data name="AboutWindow_SpecialThanksLabel" xml:space="preserve">
130130
<value>Gracias especiales</value>
@@ -156,7 +156,7 @@ Todos nuestros cazadores de estrellas, seguidores y seguidores, para los cálido
156156
<value>Copiar información de la versión</value>
157157
</data>
158158
<data name="AboutWindow_CopyVersionLabel" xml:space="preserve">
159-
<value>Copia la información de la versión al portapapeles.</value>
159+
<value>Copia la información de la versión al portapapeles</value>
160160
</data>
161161
<data name="AboutWindow_CopyVersionMessage" xml:space="preserve">
162162
<value>La información de la versión fue copiada al portapapeles.</value>
@@ -185,4 +185,7 @@ Todos nuestros cazadores de estrellas, seguidores y seguidores, para los cálido
185185
<data name="AboutWindow_ReportAnIssue" xml:space="preserve">
186186
<value>Reportar un problema</value>
187187
</data>
188+
<data name="AboutWIndow_ViewLogFile" xml:space="preserve">
189+
<value>Abrir log en el Explorador de Archivos</value>
190+
</data>
188191
</root>

Rubberduck.Resources/About/AboutUI.fr.resx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Icônes IDE de SharpDevelop
132132
Support localisation WPF par Grant Frisken</value>
133133
</data>
134134
<data name="AboutWindow_Copyright" xml:space="preserve">
135-
<value>© Copyright 2014-2018 Rubberduck project contributors</value>
135+
<value>© Copyright 2014-{0} Rubberduck project contributors</value>
136136
</data>
137137
<data name="AboutWindow_ContributorsHeader" xml:space="preserve">
138138
<value>Contributeurs et supporters:</value>
@@ -184,4 +184,7 @@ Tous ceux qui nous ont donné une étoile ou un "like"
184184
<data name="AboutWindow_ReportAnIssue" xml:space="preserve">
185185
<value>Rapporter un problème</value>
186186
</data>
187+
<data name="AboutWindow_ViewLogLabel" xml:space="preserve">
188+
<value>Afficher le journal dans l'explorateur de fichiers</value>
189+
</data>
187190
</root>

Rubberduck.Resources/About/AboutUI.resx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
<value>About Rubberduck</value>
125125
</data>
126126
<data name="AboutWindow_Copyright" xml:space="preserve">
127-
<value>© Copyright 2014-2018 Rubberduck project contributors</value>
127+
<value>© Copyright 2014-{0} Rubberduck project contributors</value>
128128
</data>
129129
<data name="AboutWindow_SpecialThanksLabel" xml:space="preserve">
130130
<value>Special Thanks</value>
@@ -156,7 +156,7 @@ All our stargazers, likers &amp; followers, for the warm fuzzies
156156
<value>Copy version info</value>
157157
</data>
158158
<data name="AboutWindow_CopyVersionLabel" xml:space="preserve">
159-
<value>Copy version information to clipboard.</value>
159+
<value>Copy version information to clipboard</value>
160160
</data>
161161
<data name="AboutWindow_CopyVersionMessage" xml:space="preserve">
162162
<value>Version information was copied to clipboard.</value>
@@ -185,4 +185,7 @@ All our stargazers, likers &amp; followers, for the warm fuzzies
185185
<data name="AboutWindow_ReportAnIssue" xml:space="preserve">
186186
<value>Report an issue</value>
187187
</data>
188-
</root>
188+
<data name="AboutWindow_ViewLogLabel" xml:space="preserve">
189+
<value>View log in File Explorer</value>
190+
</data>
191+
</root>

0 commit comments

Comments
 (0)