Skip to content

Commit d70da54

Browse files
authored
Merge pull request #4850 from fernandreu/next
Add option to view log in explorer. Ref #4797
2 parents 1e3e615 + 63597f3 commit d70da54

File tree

10 files changed

+72
-38
lines changed

10 files changed

+72
-38
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
}
Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Diagnostics;
33
using NLog;
4+
using NLog.Targets;
45
using Rubberduck.Resources.About;
56
using Rubberduck.UI.Command;
67
using Rubberduck.VersionCheck;
@@ -16,6 +17,9 @@ public class AboutControlViewModel
1617
public AboutControlViewModel(IVersionCheck version)
1718
{
1819
_version = version;
20+
21+
UriCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteUri);
22+
ViewLogCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteViewLog);
1923
}
2024

2125
public string Version => string.Format(Resources.RubberduckUI.Rubberduck_AboutBuild, _version.CurrentVersion);
@@ -30,24 +34,29 @@ public AboutControlViewModel(IVersionCheck version)
3034

3135
public string HostExecutable => string.Format(AboutUI.AboutWindow_HostExecutable,
3236
Path.GetFileName(Application.ExecutablePath).ToUpper()); // .ToUpper() used to convert ExceL.EXE -> EXCEL.EXE
37+
38+
public string AboutCopyright =>
39+
string.Format(AboutUI.AboutWindow_Copyright, DateTime.Now.Year);
40+
41+
public CommandBase UriCommand { get; }
42+
43+
public CommandBase ViewLogCommand { get; }
3344

34-
private CommandBase _uriCommand;
35-
public CommandBase UriCommand
45+
private void ExecuteUri(object parameter)
3646
{
37-
get
38-
{
39-
if (_uriCommand != null)
40-
{
41-
return _uriCommand;
42-
}
43-
return _uriCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), uri =>
44-
{
45-
Process.Start(new ProcessStartInfo(((Uri)uri).AbsoluteUri));
46-
});
47-
}
47+
Process.Start(new ProcessStartInfo(((Uri)parameter).AbsoluteUri));
4848
}
4949

50-
public string AboutCopyright =>
51-
string.Format(AboutUI.AboutWindow_Copyright, DateTime.Now.Year);
50+
private void ExecuteViewLog(object parameter)
51+
{
52+
var fileTarget = (FileTarget) LogManager.Configuration.FindTargetByName("file");
53+
54+
var logEventInfo = new LogEventInfo { TimeStamp = DateTime.Now };
55+
var fileName = fileTarget.FileName.Render(logEventInfo);
56+
57+
// The /select argument will only work if the path has backslashes
58+
fileName = fileName.Replace("/", "\\");
59+
Process.Start(new ProcessStartInfo("explorer.exe", $"/select, \"{fileName}\""));
60+
}
5261
}
5362
}

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: 3 additions & 3 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>
@@ -156,7 +156,7 @@ Všichni ti, co koukají na hvězdy, oblíbenci a následovníci,, pro ten tepl
156156
<value>Zkopírovat informace o verzi</value>
157157
</data>
158158
<data name="AboutWindow_CopyVersionLabel" xml:space="preserve">
159-
<value>Klikněte zde pro zkopírování informací do schánky.</value>
159+
<value>Klikněte zde pro zkopírování informací do schánky</value>
160160
</data>
161161
<data name="AboutWindow_CopyVersionMessage" xml:space="preserve">
162162
<value>Informace o verzi byly zkopírovány do schránky.</value>
@@ -185,4 +185,4 @@ 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+
</root>

Rubberduck.Resources/About/AboutUI.de.resx

Lines changed: 5 additions & 2 deletions
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>
@@ -156,7 +156,7 @@ Allen Sternguckern, Likern &amp; Followern, für das warme Kribbeln
156156
<value>Erfolgreich Kopiert</value>
157157
</data>
158158
<data name="AboutWindow_CopyVersionLabel" xml:space="preserve">
159-
<value>Hier klicken, um Versionsinformation in Zwischenablage zu kopieren.</value>
159+
<value>Hier klicken, um Versionsinformation in Zwischenablage zu kopieren</value>
160160
</data>
161161
<data name="AboutWindow_CopyVersionMessage" xml:space="preserve">
162162
<value>Versionsinformation in Zwischenablage kopiert.</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: 2 additions & 2 deletions
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>
@@ -155,7 +155,7 @@ Tous ceux qui nous ont donné une étoile ou un "like"
155155
<value>Les informations ont été copiées dans le presse-papier.</value>
156156
</data>
157157
<data name="AboutWindow_CopyVersionLabel" xml:space="preserve">
158-
<value>Cliquer ici pour copier les informations dans le presse-papier.</value>
158+
<value>Cliquer ici pour copier les informations dans le presse-papier</value>
159159
</data>
160160
<data name="AboutWindow_CopyVersionCaption" xml:space="preserve">
161161
<value>Copie complétée.</value>

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)