public static void DoReboot(BootEntry entry, bool confirmation = true) { if (confirmation) { string message = string.Format("Are you sure want to reboot to {0} right now?", entry.Name); if (MessageBoxResult.Yes != MessageBox.Show(message, "Reboot confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No)) { return; } } EFIEnvironment.SetBootNext(entry); if (!NativeMethods.ExitWindowsEx(ExitWindows.Reboot, ShutdownReason.MajorApplication | ShutdownReason.MinorInstallation | ShutdownReason.FlagPlanned)) { MessageBox.Show("Unable to reboot your computer", "Reboot failure", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void OnBootNextClick(object sender, BootEntryEventArgs e) { EFIEnvironment.SetBootNext(e.BootEntry); ViewModel.MarkAsNext(e.BootEntry); }