@@ -17,6 +17,9 @@ public class AboutControlViewModel
17
17
public AboutControlViewModel ( IVersionCheck version )
18
18
{
19
19
_version = version ;
20
+
21
+ UriCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , ExecuteUri ) ;
22
+ ViewLogCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , ExecuteViewLog ) ;
20
23
}
21
24
22
25
public string Version => string . Format ( Resources . RubberduckUI . Rubberduck_AboutBuild , _version . CurrentVersion ) ;
@@ -32,46 +35,28 @@ public AboutControlViewModel(IVersionCheck version)
32
35
public string HostExecutable => string . Format ( AboutUI . AboutWindow_HostExecutable ,
33
36
Path . GetFileName ( Application . ExecutablePath ) . ToUpper ( ) ) ; // .ToUpper() used to convert ExceL.EXE -> EXCEL.EXE
34
37
35
- private CommandBase _uriCommand ;
36
- public CommandBase UriCommand
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 ; }
44
+
45
+ private void ExecuteUri ( object parameter )
37
46
{
38
- get
39
- {
40
- if ( _uriCommand != null )
41
- {
42
- return _uriCommand ;
43
- }
44
- return _uriCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , uri =>
45
- {
46
- Process . Start ( new ProcessStartInfo ( ( ( Uri ) uri ) . AbsoluteUri ) ) ;
47
- } ) ;
48
- }
47
+ Process . Start ( new ProcessStartInfo ( ( ( Uri ) parameter ) . AbsoluteUri ) ) ;
49
48
}
50
49
51
- private CommandBase _viewLogCommand ;
52
- public CommandBase ViewLogCommand
50
+ private void ExecuteViewLog ( object parameter )
53
51
{
54
- get
55
- {
56
- if ( _viewLogCommand != null )
57
- {
58
- return _viewLogCommand ;
59
- }
60
- return _viewLogCommand = new DelegateCommand ( LogManager . GetCurrentClassLogger ( ) , _ =>
61
- {
62
- var fileTarget = ( FileTarget ) LogManager . Configuration . FindTargetByName ( "file" ) ;
52
+ var fileTarget = ( FileTarget ) LogManager . Configuration . FindTargetByName ( "file" ) ;
63
53
64
- var logEventInfo = new LogEventInfo { TimeStamp = DateTime . Now } ;
65
- var fileName = fileTarget . FileName . Render ( logEventInfo ) ;
54
+ var logEventInfo = new LogEventInfo { TimeStamp = DateTime . Now } ;
55
+ var fileName = fileTarget . FileName . Render ( logEventInfo ) ;
66
56
67
- // The /select argument will only work if the path has backslashes
68
- fileName = fileName . Replace ( "/" , "\\ " ) ;
69
- Process . Start ( new ProcessStartInfo ( "explorer.exe" , $ "/select, \" { fileName } \" ") ) ;
70
- } ) ;
71
- }
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 } \" ") ) ;
72
60
}
73
-
74
- public string AboutCopyright =>
75
- string . Format ( AboutUI . AboutWindow_Copyright , DateTime . Now . Year ) ;
76
61
}
77
62
}
0 commit comments