2626using System . Windows . Controls . Primitives ;
2727using System . Windows . Data ;
2828using System . Windows . Input ;
29- using System . Windows . Navigation ;
3029
3130using ICSharpCode . AvalonEdit . Rendering ;
3231using ICSharpCode . Decompiler ;
33- using ICSharpCode . ILSpy . AssemblyTree ;
3432using ICSharpCode . ILSpy . Properties ;
3533using ICSharpCode . ILSpy . TextView ;
3634using ICSharpCode . ILSpy . Themes ;
3735using ICSharpCode . ILSpy . Updates ;
36+ using ICSharpCode . ILSpy . ViewModels ;
3837
3938namespace ICSharpCode . ILSpy
4039{
4140 [ ExportMainMenuCommand ( ParentMenuID = nameof ( Resources . _Help ) , Header = nameof ( Resources . _About ) , MenuOrder = 99999 ) ]
4241 [ Shared ]
43- public sealed class AboutPageCommand ( AssemblyTreeModel assemblyTreeModel ) : SimpleCommand
42+ public sealed class AboutPage : SimpleCommand
4443 {
44+ readonly SettingsService settingsService ;
45+ readonly IEnumerable < IAboutPageAddition > aboutPageAdditions ;
46+
47+ public AboutPage ( SettingsService settingsService , IEnumerable < IAboutPageAddition > aboutPageAdditions )
48+ {
49+ this . settingsService = settingsService ;
50+ this . aboutPageAdditions = aboutPageAdditions ;
51+ MessageBus < ShowAboutPageEventArgs > . Subscribers += ( _ , e ) => ShowAboutPage ( e . TabPage ) ;
52+ }
53+
4554 public override void Execute ( object parameter )
4655 {
47- assemblyTreeModel . NavigateTo (
48- new RequestNavigateEventArgs ( new Uri ( "resource://aboutpage" ) , null ) ,
49- inNewTabPage : true
50- ) ;
56+ MessageBus . Send ( this , new NavigateToEventArgs ( new ( new ( "resource://aboutpage" ) , null ) , inNewTabPage : true ) ) ;
5157 }
52- }
5358
54- [ Export ]
55- [ Shared ]
56- public sealed class AboutPage ( IEnumerable < IAboutPageAddition > aboutPageAdditions , SettingsService settingsService )
57- {
58- public void Display ( DecompilerTextView textView )
59+ private void ShowAboutPage ( TabPageModel tabPage )
60+ {
61+ tabPage . ShowTextView ( Display ) ;
62+ }
63+
64+ private void Display ( DecompilerTextView textView )
5965 {
6066 AvalonEditTextOutput output = new AvalonEditTextOutput ( ) {
6167 Title = Resources . About ,
@@ -72,14 +78,14 @@ public void Display(DecompilerTextView textView)
7278 HorizontalAlignment = HorizontalAlignment . Center ,
7379 Orientation = Orientation . Horizontal
7480 } ;
75- if ( NotifyOfUpdatesStrategy . LatestAvailableVersion == null )
81+ if ( UpdateService . LatestAvailableVersion == null )
7682 {
7783 AddUpdateCheckButton ( stackPanel , textView ) ;
7884 }
7985 else
8086 {
8187 // we already retrieved the latest version sometime earlier
82- ShowAvailableVersion ( NotifyOfUpdatesStrategy . LatestAvailableVersion , stackPanel ) ;
88+ ShowAvailableVersion ( UpdateService . LatestAvailableVersion , stackPanel ) ;
8389 }
8490 CheckBox checkBox = new ( ) {
8591 Margin = new Thickness ( 4 ) ,
@@ -104,8 +110,7 @@ public void Display(DecompilerTextView textView)
104110 {
105111 using ( StreamReader r = new StreamReader ( s ) )
106112 {
107- string line ;
108- while ( ( line = r . ReadLine ( ) ) != null )
113+ while ( r . ReadLine ( ) is { } line )
109114 {
110115 output . WriteLine ( line ) ;
111116 }
@@ -166,7 +171,7 @@ static void AddUpdateCheckButton(StackPanel stackPanel, DecompilerTextView textV
166171
167172 try
168173 {
169- AvailableVersionInfo vInfo = await NotifyOfUpdatesStrategy . GetLatestVersionAsync ( ) ;
174+ AvailableVersionInfo vInfo = await UpdateService . GetLatestVersionAsync ( ) ;
170175 stackPanel . Children . Clear ( ) ;
171176 ShowAvailableVersion ( vInfo , stackPanel ) ;
172177 }
@@ -209,7 +214,7 @@ static void ShowAvailableVersion(AvailableVersionInfo availableVersion, StackPan
209214 button . Content = Resources . Download ;
210215 button . Cursor = Cursors . Arrow ;
211216 button . Click += delegate {
212- MainWindow . OpenLink ( availableVersion . DownloadUrl ) ;
217+ GlobalUtils . OpenLink ( availableVersion . DownloadUrl ) ;
213218 } ;
214219 stackPanel . Children . Add ( button ) ;
215220 }
0 commit comments