@@ -12,71 +12,30 @@ namespace WorkspaceLauncherForVSCode.Pages
1212{
1313 public sealed partial class HelpPage : ListPage
1414 {
15- private static readonly ListItem _openSettingsItem = new ListItem ( new OpenInExplorerCommand ( Utilities . BaseSettingsPath ( Constant . AppName ) , null , "Open extension settings / logs folder" ) ) ;
16- private static readonly ListItem _viewSourceItem = new ListItem ( new OpenUrlCommand ( "https://github.com/tanchekwei/WorkspaceLauncherForVSCode" , "View source code" , Classes . Icon . GitHub ) ) ;
17- private static readonly ListItem _reportBugItem = new ListItem ( new OpenUrlCommand ( "https://github.com/tanchekwei/WorkspaceLauncherForVSCode/issues/new" , "Report issue" , Classes . Icon . GitHub ) ) ;
1815 private readonly ListItem _settingsItem ;
19- private int _total ;
20- private int _totalVisualStudio ;
21- private int _totalVisualStudioCode ;
22- public HelpPage ( SettingsManager settingsManager )
16+ private readonly CountTracker _countTracker ;
17+ public HelpPage ( SettingsManager settingsManager , CountTracker countTracker )
2318 {
2419 Name = "Help" ;
2520 Icon = Classes . Icon . Help ;
2621 Id = "HelpPage" ;
2722 _settingsItem = new ListItem ( settingsManager . Settings . SettingsPage ) { Title = "Setting" , Icon = Classes . Icon . Setting } ;
23+ _countTracker = countTracker ;
2824 }
2925
3026 public override IListItem [ ] GetItems ( )
3127 {
28+ StaticHelpItems . CountItems [ 0 ] . Title = _countTracker [ CountType . VisualStudio ] . ToString ( ) ;
29+ StaticHelpItems . CountItems [ 1 ] . Title = _countTracker [ CountType . VisualStudioCode ] . ToString ( ) ;
30+ StaticHelpItems . CountItems [ 2 ] . Title = _countTracker [ CountType . Total ] . ToString ( ) ;
3231 return [
33- _reportBugItem ,
34- _viewSourceItem ,
35- new ListItem ( )
36- {
37- Title = $ "{ _totalVisualStudio } ",
38- Subtitle = "Visual Studio Count" ,
39- Icon = Classes . Icon . VisualStudio ,
40- } ,
41- new ListItem ( )
42- {
43- Title = $ "{ _totalVisualStudioCode } ",
44- Subtitle = "Visual Studio Code Count" ,
45- Icon = Classes . Icon . VisualStudioCode ,
46- } ,
47- new ListItem ( )
48- {
49- Title = $ "{ _total } ",
50- Subtitle = "Visual Studio / Code Count" ,
51- Icon = Classes . Icon . VisualStudioAndVisualStudioCode ,
52- } ,
53- new ListItem ( )
54- {
55- Title = Assembly . GetExecutingAssembly ( ) . GetName ( ) . Version ? . ToString ( ) ?? string . Empty ,
56- Subtitle = "Extension Version" ,
57- Icon = Classes . Icon . Extension ,
58- } ,
59- _settingsItem ,
60- _openSettingsItem ,
32+ StaticHelpItems . ReportBug ,
33+ StaticHelpItems . ViewSource ,
34+ ..StaticHelpItems . CountItems ,
35+ StaticHelpItems . ExtensionVersion ,
36+ StaticHelpItems . SettingsItem ,
37+ StaticHelpItems . OpenSettings ,
6138 ] ;
6239 }
63-
64- public void UpdateTotal ( int count )
65- {
66- _total = count ;
67- RaiseItemsChanged ( ) ;
68- }
69-
70- public void UpdateTotalVisualStudio ( int count )
71- {
72- _totalVisualStudio = count ;
73- RaiseItemsChanged ( ) ;
74- }
75-
76- public void UpdateTotalVisualStudioCode ( int count )
77- {
78- _totalVisualStudioCode = count ;
79- RaiseItemsChanged ( ) ;
80- }
8140 }
8241}
0 commit comments