private void Application_Startup(object sender, StartupEventArgs e) { #if !DEBUG singleInstanceMutex = new Mutex(true, $"Local\\{APP_GUID}", out var createdNew); if (!createdNew) { Shutdown(); return; } #endif Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; var profileManagerViewModel = new ProfileManagerViewModel(); var result = new ProfileManagerWindow { DataContext = profileManagerViewModel }.ShowDialog() ?? false; if (!result) { Shutdown(); return; } var wnd = new MainWindow { DataContext = new MainViewModel(profileManagerViewModel.SelectedDatabase) }; Current.ShutdownMode = ShutdownMode.OnMainWindowClose; Current.MainWindow = wnd; wnd.Show(); }
public ProfileManagerWindow() { InitializeComponent(); viewModel = new ProfileManagerViewModel(); this.DataContext = viewModel; }
/// <summary> /// Initializes a new instance of the <see cref="ProfileManagerWindow" /> class. /// </summary> /// <param name="viewModel">The view model</param> public ProfileManagerWindow(ProfileManagerViewModel viewModel) { this.InitializeComponent(); this.DataContext = viewModel; }