11using System . Collections . Generic ;
22using System . Collections . ObjectModel ;
33using System . Linq ;
4+ using System . Threading . Tasks ;
45using System . Windows . Input ;
56using AsyncAwaitBestPractices . MVVM ;
67using Prism . Commands ;
2122using WDE . MVVM . Observable ;
2223using WoWDatabaseEditorCore . CoreVersion ;
2324using WoWDatabaseEditorCore . Extensions ;
25+ using WoWDatabaseEditorCore . Services . DotNetUtils ;
2426using WoWDatabaseEditorCore . Services . Http ;
2527using WoWDatabaseEditorCore . Services . NewItemService ;
2628using WoWDatabaseEditorCore . Services . Statistics ;
@@ -32,6 +34,7 @@ public class QuickStartViewModel : ObservableBase, IDocument
3234 private readonly ISolutionItemIconRegistry iconRegistry ;
3335 private readonly ISolutionItemNameRegistry nameRegistry ;
3436 private readonly IMostRecentlyUsedService mostRecentlyUsedService ;
37+ private readonly IDotNetService dotNetService ;
3538 private bool showGiveStarBox ;
3639 public AboutViewModel AboutViewModel { get ; }
3740 public ObservableCollection < NewItemPrototypeInfo > FlatItemPrototypes { get ; } = new ( ) ;
@@ -62,11 +65,14 @@ public QuickStartViewModel(ISolutionItemProvideService solutionItemProvideServic
6265 IStatisticsService statisticsService ,
6366 IApplicationReleaseConfiguration applicationReleaseConfiguration ,
6467 IUrlOpenService urlOpenService ,
68+ IDotNetService dotNetService ,
69+ IWindowManager windowManager ,
6570 AboutViewModel aboutViewModel )
6671 {
6772 this . iconRegistry = iconRegistry ;
6873 this . nameRegistry = nameRegistry ;
6974 this . mostRecentlyUsedService = mostRecentlyUsedService ;
75+ this . dotNetService = dotNetService ;
7076 Wizards . AddRange ( wizards . Where ( w => w . IsCompatibleWithCore ( currentCoreVersion . Current ) ) ) ;
7177 HasWizards = Wizards . Count > 0 ;
7278 AboutViewModel = aboutViewModel ;
@@ -134,13 +140,28 @@ public QuickStartViewModel(ISolutionItemProvideService solutionItemProvideServic
134140 mainThread . Dispatch ( ReloadMruList ) ;
135141 } , true ) ) ;
136142
143+ OpenDotNet6Website = new AsyncAutoCommand ( async ( ) =>
144+ {
145+ var url = dotNetService . DownloadDotNet6Link ;
146+ windowManager . OpenUrl ( url . ToString ( ) ) ;
147+ } ) ;
148+
149+ CheckDotNet ( ) . ListenErrors ( ) ;
150+
137151 ShowGiveStarBox = statisticsService . RunCounter > 20 &&
138152 ! applicationReleaseConfiguration . GetBool ( "SKIP_STAR_BOX" ) . GetValueOrDefault ( ) &&
139153 ! userSettings . Get < QuickStartSettings > ( ) . DismissedLeaveStarBox ;
140154
141155 ReloadMruList ( ) ;
142156 }
143157
158+ private async Task CheckDotNet ( )
159+ {
160+ var isInstalled = await dotNetService . IsDotNet6Installed ( ) ;
161+ IsDotNet6Installed = isInstalled ;
162+ RaisePropertyChanged ( nameof ( IsDotNet6Installed ) ) ;
163+ }
164+
144165 private void ReloadMruList ( )
145166 {
146167 MostRecentlyUsedItems . Clear ( ) ;
@@ -154,6 +175,8 @@ private void ReloadMruList()
154175 }
155176 }
156177
178+ public bool IsDotNet6Installed { get ; private set ; } = true ;
179+ public AsyncAutoCommand OpenDotNet6Website { get ; }
157180 public AsyncAutoCommand < NewItemPrototypeInfo > LoadItemCommand { get ; }
158181 public AsyncAutoCommand < IWizardProvider > LoadWizard { get ; }
159182 public AsyncAutoCommand < MostRecentlyUsedViewModel > OpenMostRecentlyUsedCommand { get ; }
0 commit comments