|
|
@@ -1,4 +1,5 @@
|
|
|
using System.Diagnostics;
|
|
|
+using System.Runtime;
|
|
|
using Avalonia;
|
|
|
using Avalonia.Controls;
|
|
|
using Avalonia.Controls.ApplicationLifetimes;
|
|
|
@@ -20,9 +21,6 @@ using PicView.Core.MacOS.FileAssociation;
|
|
|
using PicView.Core.MacOS.Wallpaper;
|
|
|
using PicView.Core.ProcessHandling;
|
|
|
using PicView.Core.ViewModels;
|
|
|
-#if DEBUG
|
|
|
-using System.Runtime;
|
|
|
-#endif
|
|
|
|
|
|
namespace PicView.Avalonia.MacOS;
|
|
|
|
|
|
@@ -40,10 +38,8 @@ public class App : Application, IPlatformSpecificService
|
|
|
|
|
|
public override void Initialize()
|
|
|
{
|
|
|
-#if DEBUG
|
|
|
ProfileOptimization.SetProfileRoot(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config/"));
|
|
|
ProfileOptimization.StartProfile("ProfileOptimization");
|
|
|
-#endif
|
|
|
base.OnFrameworkInitializationCompleted();
|
|
|
}
|
|
|
|
|
|
@@ -61,16 +57,21 @@ public class App : Application, IPlatformSpecificService
|
|
|
var settingsExists = await LoadSettingsAsync().ConfigureAwait(false);
|
|
|
|
|
|
TranslationManager.Init();
|
|
|
- _vm = new MainViewModel(this);
|
|
|
-
|
|
|
+
|
|
|
await Dispatcher.UIThread.InvokeAsync(() =>
|
|
|
{
|
|
|
ThemeManager.DetermineTheme(Current, settingsExists);
|
|
|
|
|
|
_mainWindow = new MacMainWindow();
|
|
|
desktop.MainWindow = _mainWindow;
|
|
|
- _mainWindow.DataContext = _vm;
|
|
|
+ },DispatcherPriority.Send);
|
|
|
+
|
|
|
+ _vm = new MainViewModel(this);
|
|
|
+
|
|
|
+ await Dispatcher.UIThread.InvokeAsync(() =>
|
|
|
+ {
|
|
|
|
|
|
+ _mainWindow.DataContext = _vm;
|
|
|
StartUpHelper.Start(_vm, settingsExists, desktop, _mainWindow);
|
|
|
},DispatcherPriority.Send);
|
|
|
}
|