@@ -45,13 +45,10 @@ public partial class App : Application
4545 public static AppModel AppModel { get ; private set ; }
4646 public static RecentItems RecentItemsManager { get ; private set ; }
4747 public static QuickAccessManager QuickAccessManager { get ; private set ; }
48- public static CloudDrivesManager CloudDrivesManager { get ; private set ; }
49- public static WSLDistroManager WSLDistroManager { get ; private set ; }
5048 public static LibraryManager LibraryManager { get ; private set ; }
5149 public static FileTagsManager FileTagsManager { get ; private set ; }
5250
5351 public static ILogger Logger { get ; private set ; }
54- public static SecondaryTileHelper SecondaryTileHelper { get ; private set ; } = new ( ) ;
5552
5653 /// <summary>
5754 /// Initializes the singleton application object. This is the first line of authored code
@@ -138,6 +135,7 @@ private IHost ConfigureHost()
138135 . AddSingleton < IJumpListService , JumpListService > ( )
139136 . AddSingleton < IRemovableDrivesService , RemovableDrivesService > ( )
140137 . AddSingleton < INetworkDrivesService , NetworkDrivesService > ( )
138+ . AddSingleton < IStartMenuService , StartMenuService > ( )
141139 . AddSingleton < MainPageViewModel > ( )
142140 . AddSingleton < PreviewPaneViewModel > ( )
143141 . AddSingleton < SidebarViewModel > ( )
@@ -156,31 +154,30 @@ private static async Task InitializeAppComponentsAsync()
156154 var generalSettingsService = userSettingsService . GeneralSettingsService ;
157155
158156 // Start off a list of tasks we need to run before we can continue startup
159- await Task . Run ( async ( ) =>
160- {
161- await Task . WhenAll (
162- OptionalTaskAsync ( CloudDrivesManager . UpdateDrivesAsync ( ) , generalSettingsService . ShowCloudDrivesSection ) ,
163- LibraryManager . UpdateLibrariesAsync ( ) ,
164- OptionalTaskAsync ( WSLDistroManager . UpdateDrivesAsync ( ) , generalSettingsService . ShowWslSection ) ,
165- OptionalTaskAsync ( FileTagsManager . UpdateFileTagsAsync ( ) , generalSettingsService . ShowFileTagsSection ) ,
166- QuickAccessManager . InitializeAsync ( )
167- ) ;
168-
169- await Task . WhenAll (
170- JumpListHelper . InitializeUpdatesAsync ( ) ,
171- addItemService . InitializeAsync ( ) ,
172- ContextMenu . WarmUpQueryContextMenuAsync ( )
173- ) ;
174-
175- FileTagsHelper . UpdateTagsDb ( ) ;
176- } ) ;
157+ await Task . WhenAll (
158+ OptionalTaskAsync ( CloudDrivesManager . UpdateDrivesAsync ( ) , generalSettingsService . ShowCloudDrivesSection ) ,
159+ LibraryManager . UpdateLibrariesAsync ( ) ,
160+ OptionalTaskAsync ( WSLDistroManager . UpdateDrivesAsync ( ) , generalSettingsService . ShowWslSection ) ,
161+ OptionalTaskAsync ( FileTagsManager . UpdateFileTagsAsync ( ) , generalSettingsService . ShowFileTagsSection ) ,
162+ QuickAccessManager . InitializeAsync ( )
163+ ) ;
164+
165+ await Task . WhenAll (
166+ JumpListHelper . InitializeUpdatesAsync ( ) ,
167+ addItemService . InitializeAsync ( ) ,
168+ ContextMenu . WarmUpQueryContextMenuAsync ( )
169+ ) ;
170+
171+ FileTagsHelper . UpdateTagsDb ( ) ;
177172
178173 await CheckForRequiredUpdatesAsync ( ) ;
179174
180- static async Task OptionalTaskAsync ( Task task , bool condition )
175+ static Task OptionalTaskAsync ( Task task , bool condition )
181176 {
182177 if ( condition )
183- await task ;
178+ return task ;
179+
180+ return Task . CompletedTask ;
184181 }
185182 }
186183
@@ -238,8 +235,7 @@ async Task ActivateAsync()
238235 await SplashScreenLoadingTCS ! . Task . WithTimeoutAsync ( TimeSpan . FromMilliseconds ( 500 ) ) ;
239236 SplashScreenLoadingTCS = null ;
240237
241- _ = InitializeAppComponentsAsync ( ) . ContinueWith ( t => Logger . LogWarning ( t . Exception , "Error during InitializeAppComponentsAsync()" ) , TaskContinuationOptions . OnlyOnFaulted ) ;
242-
238+ _ = InitializeAppComponentsAsync ( ) ;
243239 _ = MainWindow . Instance . InitializeApplicationAsync ( appActivationArguments . Data ) ;
244240 }
245241 }
@@ -251,8 +247,6 @@ private static void EnsureSettingsAndConfigurationAreBootstrapped()
251247 RecentItemsManager ??= new RecentItems ( ) ;
252248 AppModel ??= new AppModel ( ) ;
253249 LibraryManager ??= new LibraryManager ( ) ;
254- CloudDrivesManager ??= new CloudDrivesManager ( ) ;
255- WSLDistroManager ??= new WSLDistroManager ( ) ;
256250 FileTagsManager ??= new FileTagsManager ( ) ;
257251 QuickAccessManager ??= new QuickAccessManager ( ) ;
258252 }
@@ -388,8 +382,7 @@ await SafetyExtensions.IgnoreExceptions(async () =>
388382 /// </summary>
389383 public static void SaveSessionTabs ( )
390384 {
391- IUserSettingsService userSettingsService = Ioc . Default . GetRequiredService < IUserSettingsService > ( ) ;
392-
385+ var userSettingsService = Ioc . Default . GetService < IUserSettingsService > ( ) ?? new UserSettingsService ( ) ;
393386 userSettingsService . GeneralSettingsService . LastSessionTabList = MainPageViewModel . AppInstances . DefaultIfEmpty ( ) . Select ( tab =>
394387 {
395388 if ( tab is not null && tab . NavigationParameter is not null )
0 commit comments