public override void OnFrameworkInitializationCompleted() { if (Directory.Exists("storage") == false) { Directory.CreateDirectory("storage"); } var viewModel = LocalStorageService.Load <MainWindowViewModel>("data.json"); if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { desktop.MainWindow = new MainWindow { DataContext = viewModel }; } base.OnFrameworkInitializationCompleted(); }