Skip to content

Commit 0eb0f17

Browse files
authored
Remove delay of loading sidebar items and other services on startup (#7104)
1 parent a93edba commit 0eb0f17

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Files/App.xaml.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,13 @@ private static async Task StartAppCenter()
155155
}
156156
}
157157

158-
public static async Task LoadOtherStuffAsync()
158+
private static async Task InitializeAppComponentsAsync()
159159
{
160160
// Start off a list of tasks we need to run before we can continue startup
161-
await StartAppCenter();
162161
await Task.Run(async () =>
163162
{
164163
await Task.WhenAll(
164+
StartAppCenter(),
165165
DrivesManager.EnumerateDrivesAsync(),
166166
CloudDrivesManager.EnumerateDrivesAsync(),
167167
LibraryManager.EnumerateLibrariesAsync(),
@@ -196,13 +196,14 @@ protected override async void OnLaunched(LaunchActivatedEventArgs e)
196196
{
197197
await logWriter.InitializeAsync("debug.log");
198198
Logger.Info($"App launched. Prelaunch: {e.PrelaunchActivated}");
199-
199+
200200
//start tracking app usage
201201
SystemInformation.Instance.TrackAppUse(e);
202202

203203
bool canEnablePrelaunch = ApiInformation.IsMethodPresent("Windows.ApplicationModel.Core.CoreApplication", "EnablePrelaunch");
204204

205205
await EnsureSettingsAndConfigurationAreBootstrapped();
206+
InitializeAppComponentsAsync().ContinueWith(t => Logger.Warn(t.Exception, "Error during LoadOtherStuffAsync()"), TaskContinuationOptions.OnlyOnFaulted);
206207

207208
var rootFrame = EnsureWindowIsInitialized();
208209

@@ -260,6 +261,7 @@ protected override async void OnFileActivated(FileActivatedEventArgs e)
260261
SystemInformation.Instance.TrackAppUse(e);
261262

262263
await EnsureSettingsAndConfigurationAreBootstrapped();
264+
InitializeAppComponentsAsync().ContinueWith(t => Logger.Warn(t.Exception, "Error during LoadOtherStuffAsync()"), TaskContinuationOptions.OnlyOnFaulted);
263265

264266
var rootFrame = EnsureWindowIsInitialized();
265267

@@ -325,6 +327,7 @@ protected override async void OnActivated(IActivatedEventArgs args)
325327
Logger.Info($"App activated by {args.Kind.ToString()}");
326328

327329
await EnsureSettingsAndConfigurationAreBootstrapped();
330+
InitializeAppComponentsAsync().ContinueWith(t => Logger.Warn(t.Exception, "Error during LoadOtherStuffAsync()"), TaskContinuationOptions.OnlyOnFaulted);
328331

329332
var rootFrame = EnsureWindowIsInitialized();
330333

Files/Views/MainPage.xaml.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,6 @@ private void Page_Loaded(object sender, RoutedEventArgs e)
337337
{
338338
_ = VisualStateManager.GoToState(this, nameof(HorizontalTabViewCollapsed), true);
339339
}
340-
341-
App.LoadOtherStuffAsync().ContinueWith(t => App.Logger.Warn(t.Exception, "Error during LoadOtherStuffAsync()"), TaskContinuationOptions.OnlyOnFaulted);
342340
}
343341

344342
private void ToggleFullScreenAccelerator(KeyboardAcceleratorInvokedEventArgs e)

0 commit comments

Comments
 (0)