private void Desktop_Startup(object sender, ControlledApplicationLifetimeStartupEventArgs e) { MessageHandlers.RegisterMessageHandlers(this); AppViewModel.Initialize(e.Args); DataContext = AppVM; if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { var window = new MainWindow { VM = new MainViewModel() }; desktop.MainWindow = window; } }
private void Desktop_Exit(object sender, ControlledApplicationLifetimeExitEventArgs e) { MessageHandlers.UnregisterMessageHandlers(this); }