private void OnCreateShortcutClick(BootEntry entry) { if (CreateShortcutClick != null) { CreateShortcutClick(this, new BootEntryEventArgs(entry)); } }
private void OnNextBootClick(BootEntry entry) { if (BootNextClick != null) { BootNextClick(this, new BootEntryEventArgs(entry)); } }
private void OnRebootClick(BootEntry entry) { if (RebootClick != null) { RebootClick(this, new BootEntryEventArgs(entry)); } }
public void MarkAsNext(BootEntry nextEntry) { foreach (BootEntry entry in Items) { entry.IsBootNext = false; } nextEntry.IsBootNext = true; }
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); } }
/// <summary> /// Initializes a new instance of <see cref="BootEntryEventArgs"/> for specified <see cref="BootEntry"/>. /// </summary> /// <param name="BootEntry">BootEntry</param> public BootEntryEventArgs(BootEntry BootEntry) { this.BootEntry = BootEntry; }
public static bool SetBootNext(BootEntry entry) { return SetBootNext(entry.Id); }