private void App_OnStartup(object sender, StartupEventArgs e) { var efis = DiskScanner.FindInstalledEfis().ToList(); var target = FindTarget(efis); if (efis.Count == 0) { BootMessageBox.Show("BootNext not installed", "BootNext is not installed yet. You will be taken to the settings dialog."); } else if (target == null) { BootMessageBox.Show("Multiple instances found", "Multiple BootNext instances found. Please select the one you want to use."); } if (target == null) { var settings = new SettingsWindow(); settings.Show(); } else { Settings.Default.PreferredEFI = target.Guid; Settings.Default.Save(); var bootDir = DiskScanner.GetBootNextDir(target) !; var window = new MainWindow(bootDir); window.Show(); } }
private void InstallButton_OnClick(object sender, RoutedEventArgs e) { var selected = (Partition?)AllEfisList.SelectedItem; if (selected == null) { return; } var result = MessageBox.Show("Installing BootNext will reset any BootNext configuration on " + "that device to default. Are you sure you want to continue?", "BootNext", MessageBoxButton.YesNo); if (result == MessageBoxResult.No) { return; } try { BootNextInterface.InstallTo(selected); } catch (Exception ex) { BootMessageBox.Show("Installation failed", $"Could not install BootNext: {ex}"); return; } // set target Settings.Default.PreferredEFI = selected.Guid; Settings.Default.Save(); ReloadInstalled(); var bootNextDir = DiskScanner.GetBootNextDir(selected.GetDriveLetter() !); BootMessageBox.Show("Installation successful", "Installation of BootNext is now finished. In order to use BootNext, " + "you need to add it to your boot order manually.\n\n" + "In order to configure BootNext, the installation folder will now be opened in an Explorer++ window."); var dir = Path.GetDirectoryName(Assembly.GetEntryAssembly() !.Location) !; const string explorerPath = @"Resources\Explorer++.exe"; Process.Start(Path.Combine(dir, explorerPath), bootNextDir); }