Skip to content

Commit

Permalink
Fix AppCenter activating issue
Browse files Browse the repository at this point in the history
  • Loading branch information
0x7c13 committed Dec 6, 2023
1 parent ae22011 commit bf11623
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Notepads/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ public App()
UnhandledException += OnUnhandledException;
TaskScheduler.UnobservedTaskException += OnUnobservedException;

var services = new Type[] { typeof(Crashes), typeof(Analytics) };
AppCenter.Start(AppCenterSecret, services);

InstanceHandlerMutex = new Mutex(true, App.ApplicationName, out bool isNew);
if (isNew)
{
Expand Down Expand Up @@ -98,6 +95,16 @@ private async Task ActivateAsync(IActivatedEventArgs e)
Window.Current.Content = rootFrame;
rootFrameCreated = true;

try
{
var services = new Type[] { typeof(Crashes), typeof(Analytics) };
AppCenter.Start(AppCenterSecret, services);
}
catch (Exception ex)
{
LoggingService.LogError($"[{nameof(App)}] Failed to start AppCenter: {ex.Message}");
}

ThemeSettingsService.Initialize();
AppSettingsService.Initialize();
}
Expand Down Expand Up @@ -181,7 +188,7 @@ private Frame CreateRootFrame(IActivatedEventArgs e)

if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
// TODO: Load state from previously suspended application
}

return rootFrame;
Expand Down

0 comments on commit bf11623

Please sign in to comment.