private void onExit() { try { // string regPath; regPath = @"SOFTWARE\Longflow\LimnorStudio\Kiosk"; RegistryKey reg = Registry.LocalMachine.OpenSubKey(regPath, false); if (reg != null) { object v = reg.GetValue("RebootOnExit", false, RegistryValueOptions.None); if (v != null) { bool reboot = ObjectToBool(v); if (reboot) { WinUtil.Reboot(); return; } } } } catch (Exception err) { MessageBox.Show(this, err.Message, "Exit kiosk", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (bExitHotkeySet) { if (UnregisterHotKey(Handle, nHotkey)) { bExitHotkeySet = false; } } if (LKiosk.UseCustomKiosk) { string kioskMode = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "KioskMode.exe"); if (File.Exists(kioskMode)) { Process p = new Process(); p.StartInfo.FileName = kioskMode; p.Start(); } } }
public static int Reboot() { return(WinUtil.Reboot()); }