//public enum WindowsType //{ // START_GAME, // SETTINGS, // STORE, // EXIT, // CLOSE_WINDOW //} private void Awake() { if (Instance == null) { Instance = this; } }
/// <summary> /// Invoked based on condition or 10-second timer. Displays /// tooltip, then performs specified action if not cancelled. /// </summary> private void TakeAction() { string action = selectedAction.ToString(); // If timer ticks with Disabled checked, it is immediate action if (waitingOnCondition == null) { timeBasedTimer.Stop(); appNotifyIcon.Visible = false; appNotifyIcon.Visible = true; if (System.Diagnostics.Debugger.IsAttached) { MessageBox.Show("In debug mode: Action not taken"); } else { WindowsController.ExitWindows(selectedAction, false); } } // Otherwise, provide ten second warning else { waitingOnCondition.StopMonitoring(); conditionComboBox.SelectedIndex = 0; appNotifyIcon.BalloonTipText = "The system will " + action + " in ten seconds. Click to cancel."; appNotifyIcon.ShowBalloonTip(10); timeBasedTimer.Interval = 10000; timeBasedTimer.Start(); } }
/// <summary> /// Execute this command. /// </summary> /// <param name="variables">The variable list of the calling code.</param> public override void Execute(VariableList variables) { bool mpBasicHome = false; using (Settings xmlreader = new Settings(MPCommon.MPConfigFile)) mpBasicHome = xmlreader.GetValueAsBool("general", "startbasichome", false); GUIGraphicsContext.ResetLastActivity(); // Stop all media before suspending g_Player.Stop(); GUIMessage msg; if (mpBasicHome) { msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, (int)GUIWindow.Window.WINDOW_SECOND_HOME, 0, null); } else { msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, (int)GUIWindow.Window.WINDOW_HOME, 0, null); } GUIWindowManager.SendThreadMessage(msg); WindowsController.ExitWindows(RestartOptions.Suspend, false); }
private ProjectContext() { Windows = new WindowsController(); var saveController = new SavesController(); GameSave = new GameSave(saveController); }
//alle 10ms private void timerCmd_Tick(object sender, EventArgs e) { getTcpMessages(); if (countRefreshGUI == 100) { countRefreshGUI = 0; tmpLabel.Text = ((axVLC.Length / 60000) * axVLC.Position).ToString() + " Minuten"; } countRefreshGUI++; //Do Actions after played a complete track if (axVLC.Position >= 0.9999243f) { axVLC.stop(); //Shutdown if activated if (shutdownAfterTrack) { shutdownAfterTrack = false; if (chkShutdownHib.Checked) { WindowsController.ExitWindows(RestartOptions.ShutDown, false); //Herunterfahren } else { WindowsController.ExitWindows(RestartOptions.Suspend, false); //Schlaffmodus } } else //play next track { doActions("Next"); } } }
/// <summary> /// Shutdown/hibernate/reboot the htpc or exit mediaportal /// </summary> /// <param name="shutdownType">logoff|suspend|hibernate|reboot|shutdown|exit</param> public void SetPowerMode(String powerMode) { switch (powerMode.ToLower()) { case "logoff": WindowsController.ExitWindows(RestartOptions.LogOff, true); break; case "suspend": WindowsController.ExitWindows(RestartOptions.Suspend, true); break; case "hibernate": WindowsController.ExitWindows(RestartOptions.Hibernate, true); break; case "reboot": WindowsController.ExitWindows(RestartOptions.Reboot, true); break; case "shutdown": WindowsController.ExitWindows(RestartOptions.ShutDown, true); break; case "exit": MediaPortal.GUI.Library.Action action = new MediaPortal.GUI.Library.Action(MediaPortal.GUI.Library.Action.ActionType.ACTION_EXIT, 0, 0); GUIGraphicsContext.OnAction(action); break; } }
private void RestartSys_Click(object sender, HtmlElementEventArgs e) { if (MessageBox.Show("确定要重启机器?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK) { WindowsController.ExitWindows(RestartOptions.Reboot, true); Sleep(5000); } }
public void Setup(UIPopup popup, WindowsController windowController) { if (popup != null) { this.popup = popup; } else { Debug.LogWarning("There's no UIPopup in the scene."); } this.windowController = windowController; }
private void timerTick_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { TimeSpan remaining = endTime - DateTime.Now; if (remaining.TotalSeconds < 0) { timerTick.Enabled = false; RestartOptions option = (RestartOptions)comboBoxRestartType.SelectedValue; WindowsController.ExitWindows(option, checkBoxForce.Checked); } maskedTextBoxTime.Text = remaining.ToString(); }
private void Awake() { if (Instance == null) { DontDestroyOnLoad(gameObject); Instance = this; } else { Destroy(gameObject); } SceneController = new SceneController(); WindowsController = new WindowsController(); ResourceController = new ResourceController(); }
//Apply selected settings and reboot private void buttonReboot_Click(object sender, EventArgs e) { if (this.testConfig()) { PwrMzrSettings pm = this.collectDataFromControls(); try { if (MessageBox.Show("The changes will be applied to the registry.", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.pwrmzrManager.changePowermizerSettings(pm); } else { return; } } catch { //All errors logged MessageBox.Show("Could't change powermizer settings. Check debug console for more details.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } try { if (MessageBox.Show("Do you want to reboot NOW?. Click NO if you want to reboot manually.", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { WindowsController.ExitWindows(RestartOptions.Reboot, false); } else { return; } } catch { log("Error while rebooting!. Try rebooting manually."); return; } } }
public static void Main() { Console.WriteLine("Restart Program\r\n--------------\r\n\r\n Select the restart mode:\r\n l - LogOff\r\n p - PowerOff\r\n r - Reboot\r\n s - Shutdown\r\n u - Suspend\r\n h - Hibernate\r\n c - Exit the program\r\n\r\n Make your choice: "); string input = Console.ReadLine(); switch (input.ToLower()) { case "l": WindowsController.ExitWindows(RestartOptions.LogOff, false); break; case "p": WindowsController.ExitWindows(RestartOptions.PowerOff, false); break; case "r": WindowsController.ExitWindows(RestartOptions.Reboot, false); break; case "s": WindowsController.ExitWindows(RestartOptions.ShutDown, false); break; case "u": WindowsController.ExitWindows(RestartOptions.Suspend, false); break; case "h": WindowsController.ExitWindows(RestartOptions.Hibernate, false); break; case "c": return; break; default: Console.WriteLine("Invalid input..."); break; } }
public void OnTimeTick(int count) { if (step == 3) { if (readyTime == 0) { Initialized = true; StartActivity("主界面"); } else { GetElementById("procNum").InnerText = (readyTime--).ToString(); } } if (step == 1) { if (initTime++ == restartTime) { WindowsController.ExitWindows(RestartOptions.Reboot, true); System.Threading.Thread.Sleep(5000); } } }
public WindowsController() { SceneManager.activeSceneChanged += TryFindCanvasOnChangedScene; Instance = this; }
/// <summary> /// //Shut System down /// </summary> public static void Shutdown() { WindowsController.ExitWindows(RestartOptions.ShutDown, true); }
// Use this for initialization void Awake() { current = this; }
protected void SafeExitWindowsThreadAfter(RestartOptions how, bool force, bool result, WindowsController.AfterExitWindowsHandler after) { _isSuspendInProgress = false; lock (this) { if (!result) { // allow further requests _ignoreSuspendUntil = DateTime.MinValue; return; } switch (how) { case RestartOptions.LogOff: case RestartOptions.Suspend: case RestartOptions.Hibernate: { // allow not before 5 seconds // *** this will block any about-to-suspend requests that have been pending before the shutdown was issued // *** (resolves the system-immediately-suspends-after-resume issue) _ignoreSuspendUntil = DateTime.Now.AddSeconds(5); break; } case RestartOptions.PowerOff: case RestartOptions.Reboot: case RestartOptions.ShutDown: { // allow not before 120 seconds, i.e. give enough time to shutdown the system (anyway this value is reset on reboot) _ignoreSuspendUntil = DateTime.Now.AddSeconds(120); break; } } } if (after != null) { after(how, force, result); } }
private void SafeExitWindows(RestartOptions how, bool force, WindowsController.AfterExitWindowsHandler after) { if (_settings.GetSetting("SingleSeat").Get<bool>()) { // shutdown method and force mode are ignored by delegated suspend/hibernate requests Log.Debug("PSClientPlugin: Delegating shutdown request to tvserver: {0}", how); if (after != null) { Log.Error("PSClientPlugin: SafeExitWindows, after != null is not supported yet"); } try { // persist the next wakeup datetime, this way 'resume last active module' feature is able to tell the difference between a wakeup done by // a user or by the PS plugin using (Settings xmlwriter = new MPSettings()) { DateTime nextWakeUp = GetNextWakeupTime(DateTime.Now); xmlwriter.SetValue("psclientplugin", "nextwakeup", nextWakeUp.ToString()); string res = xmlwriter.GetValueAsString("psclientplugin", "nextwakeup", DateTime.MaxValue.ToString()); } _isSuspendInProgress = true; Log.Debug("PSClientPlugin: Informing handlers about UserShutdownNow"); UserShutdownNow(); if (RemotePowerControl.Isconnected) { RemotePowerControl.Instance.SuspendSystem("PowerSchedulerClientPlugin", (int)how, force); } } catch (Exception e) { _isSuspendInProgress = false; Log.Error("PSClientPlugin: SuspendSystem failed! {0} {1}", e.Message, e.StackTrace); } } else { lock (this) { DateTime now = DateTime.Now; // block concurrent request? if (_ignoreSuspendUntil > now) { Log.Info("PSClientPlugin: Concurrent shutdown was ignored: {0} ; force: {1}", how, force); return; } // block any other request forever (for now) _ignoreSuspendUntil = DateTime.MaxValue; } Log.Info("PSClientPlugin: Entering shutdown {0} ; forced: {1} -- kick off shutdown thread", how, force); SafeExitWindowsThreadEnv data = new SafeExitWindowsThreadEnv(); data.that = this; data.how = how; data.force = force; data.after = after; (new Thread(SafeExitWindowsThread)).Start(data); } }
private void addQuizButton_Click(object sender, EventArgs e) { WindowsController.showAddQuizWindow(this); }
/// <summary> /// Evaluates the button number, gets its mapping and executes the action /// </summary> /// <param name="btnCode">Button code (ref: XML file)</param> /// <param name="processID">Process-ID for close/kill commands</param> private bool DoMapAction(string btnCode, int processID) { if (!_isLoaded) // No mapping loaded { Log.Info("Map: No button mapping loaded"); return(false); } Mapping map = null; map = GetMapping(btnCode); if (map == null) { return(false); } Log.Debug("{0} / {1} / {2} / {3}", map.Condition, map.ConProperty, map.Command, map.CmdProperty); Action action; if (map.Sound != string.Empty) // && !g_Player.Playing) { Util.Utils.PlaySound(map.Sound, false, true); } if (map.Focus && !GUIGraphicsContext.HasFocus) { GUIGraphicsContext.ResetLastActivity(); GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GETFOCUS, 0, 0, 0, 0, 0, null); GUIWindowManager.SendThreadMessage(msg); return(true); } switch (map.Command) { case "ACTION": // execute Action x Key key = new Key(map.CmdKeyChar, map.CmdKeyCode); Log.Debug("Executing: key {0} / {1} / Action: {2} / {3}", map.CmdKeyChar, map.CmdKeyCode, map.CmdProperty, ((Action.ActionType)Convert.ToInt32(map.CmdProperty)).ToString()); action = new Action(key, (Action.ActionType)Convert.ToInt32(map.CmdProperty), 0, 0); GUIGraphicsContext.OnAction(action); break; case "KEY": // send Key x SendKeys.SendWait(map.CmdProperty); break; case "WINDOW": // activate Window x GUIGraphicsContext.ResetLastActivity(); GUIMessage msg; if ((Convert.ToInt32(map.CmdProperty) == (int)GUIWindow.Window.WINDOW_HOME) || (Convert.ToInt32(map.CmdProperty) == (int)GUIWindow.Window.WINDOW_SECOND_HOME)) { if (_basicHome) { msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, (int)GUIWindow.Window.WINDOW_SECOND_HOME, 0, null); } else { msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, (int)GUIWindow.Window.WINDOW_HOME, 0, null); } } else { msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, Convert.ToInt32(map.CmdProperty), 0, null); } GUIWindowManager.SendThreadMessage(msg); break; case "TOGGLE": // toggle Layer 1/2 if (_currentLayer == 1) { _currentLayer = 2; } else { _currentLayer = 1; } break; case "POWER": // power down commands if ((map.CmdProperty == "STANDBY") || (map.CmdProperty == "HIBERNATE")) { GUIGraphicsContext.ResetLastActivity(); //Stop all media before suspending or hibernating if (g_Player.Playing) { GUIWindowManager.SendThreadCallbackAndWait(StopPlayback, 0, 0, null); } // this is all handled in mediaportal.cs - OnSuspend /* * if (_basicHome) * msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, (int)GUIWindow.Window.WINDOW_SECOND_HOME, 0, null); * else * msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GOTO_WINDOW, 0, 0, 0, (int)GUIWindow.Window.WINDOW_HOME, 0, null); * * GUIWindowManager.SendThreadMessage(msg); */ } switch (map.CmdProperty) { case "EXIT": action = new Action(Action.ActionType.ACTION_EXIT, 0, 0); GUIGraphicsContext.OnAction(action); break; case "REBOOT": action = new Action(Action.ActionType.ACTION_REBOOT, 0, 0); GUIGraphicsContext.OnAction(action); break; case "SHUTDOWN": action = new Action(Action.ActionType.ACTION_SHUTDOWN, 0, 0); GUIGraphicsContext.OnAction(action); break; case "STANDBY": // we need a slow standby (force=false), in order to have the onsuspend method being called on mediportal.cs // this is needed in order to have "ShowLastActiveModule" working correctly. // also using force=true results in a silent non critical D3DERR_DEVICELOST exception when resuming from powerstate. MPControlPlugin.OnSuspend(); WindowsController.ExitWindows(RestartOptions.Suspend, false); break; case "HIBERNATE": // we need a slow hibernation (force=false), in order to have the onsuspend method being called on mediportal.cs // this is needed in order to have "ShowLastActiveModule" working correctly. // also using force=true results in a silent non critical D3DERR_DEVICELOST exception when resuming from powerstate. MPControlPlugin.OnSuspend(); WindowsController.ExitWindows(RestartOptions.Hibernate, false); break; } break; case "PROCESS": { GUIGraphicsContext.ResetLastActivity(); if (processID > 0) { Process proc = Process.GetProcessById(processID); if (null != proc) { switch (map.CmdProperty) { case "CLOSE": proc.CloseMainWindow(); break; case "KILL": proc.Kill(); break; } } } } break; case "BLAST": MPControlPlugin.ProcessCommand(map.CmdProperty, true); break; default: return(false); } return(true); }
/// <summary> /// Event handler for Immediate menu option -- /// triggers power management event without condition. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void immediateMenuItem_Click(object sender, EventArgs e) { ToolStripMenuItem item = (ToolStripMenuItem)sender; WindowsController.ExitWindows((RestartOptions)(item.Tag), true); }
public void HandlePacket(Packets packet) { var packetType = packet.PacketType; var errorController = new ErrorController(Client, packet); var windowsController = new WindowsController(Client, packet); var settingsController = new SettingsController(Client, packet); var serverController = new ServerController(Client, packet); if (packetType == PacketType.InvalidOrEmptyPacket) { errorController.InvalidPacket(); return; } if (packetType == PacketType.RequestWindowsInformation) { windowsController.GetWindowsInformation(); return; } if (packetType == PacketType.AesHandshake) { serverController.AesHandshake(); return; } if (!AuthClient.Authenticated && packetType == PacketType.Authenticate) { serverController.Login(); return; } if (AuthClient.Authenticated) { #region //Build a controller workshop! var fileController = new FileController(Client, packet); var processController = new ProcessController(Client, packet); var cpuController = new CpuController(Client, packet); var systemController = new SystemController(Client, packet); var operatingSystemController = new OperatingSystemController(Client, packet); var networkController = new NetworkController(Client, packet); var gpuController = new GpuController(Client, packet); var screenShareController = new ScreenShareController(Client, packet); var pluginController = new PluginController(Client, packet); var webcamController = new WebCamController(Client, packet); #endregion //Running long processes in a new task prevents timeouts from firing switch (packetType) { case PacketType.RequestFile: Task.Run(() => { fileController.RequestFile(); }); break; case PacketType.RequestGpuInformation: gpuController.GetGpuInformation(); break; case PacketType.RemoveFile: fileController.RemoveFile(); break; case PacketType.Plugin: Task.Run(() => { pluginController.StartPlugin(); }); break; case PacketType.ApprovePlugin: pluginController.ApprovePlugin(); break; case PacketType.GetPendingPlugins: pluginController.GetPendingPlugins(); break; case PacketType.GetPlugins: pluginController.ListPlugins(); break; case PacketType.GetBadPlugins: pluginController.ListBadPlugins(); break; case PacketType.CreateFileTree: fileController.CreateFileTree(); break; case PacketType.StartCamera: webcamController.StartCamera(); break; case PacketType.StopCamera: Task.Run(() => { webcamController.StopCamera(); }); break; case PacketType.PauseCamera: webcamController.PauseCamera(); break; case PacketType.GetCameras: webcamController.GetCameras(); break; case PacketType.StartCameraStream: webcamController.StartStream(); break; case PacketType.StopCameraStream: webcamController.StopStream(); break; case PacketType.RequestProcess: processController.RequestProcessInformation(); break; case PacketType.RequestCpuInformation: cpuController.GetCpuInformation(); break; case PacketType.RequestOsInformation: operatingSystemController.GetOperatingSystemInformation(); break; case PacketType.RestartServer: serverController.RestartServer(); break; case PacketType.RequestNetworkInformation: Task.Run(() => { networkController.GetNetworkInformation(); }); break; case PacketType.SearchFiles: Task.Run(() => { fileController.SearchFile(); }); break; case PacketType.UseWebServer: settingsController.ChangeWebServerUse(); break; case PacketType.ChangeWebServerPort: settingsController.ChangeWebServerPort(); break; case PacketType.ChangeWebFilePath: settingsController.ChangeWebFilePath(); break; case PacketType.ChangeTaskServerPort: settingsController.ChangeTaskServerPort(); break; case PacketType.ChangeVncPort: settingsController.ChangeVncPort(); break; case PacketType.ChangeVncPass: settingsController.ChangeVncPassword(); break; case PacketType.ChangeVncProxyPort: settingsController.ChangeVncProxyPort(); break; case PacketType.ChangeNetworkResolve: settingsController.ChangeNetworkResolve(); break; case PacketType.ChangeLoadPlugins: settingsController.ChangeLoadPlugins(); break; case PacketType.ChangeUseTerminal: settingsController.ChangeUseTerminal(); break; case PacketType.GetCurrentSettings: settingsController.GetCurrentSettings(); break; case PacketType.RequestSystemInformation: systemController.GetSystemInformation(); break; case PacketType.GetEventLogs: //WHO REENABLED THIS // Task.Factory.StartNew(() => operatingSystemController.GetEventLogs()); break; case PacketType.StartScreenShare: screenShareController.StartScreenShare(); break; case PacketType.StopScreenShare: screenShareController.StopScreenShare(); break; case PacketType.ApproveFile: fileController.ApproveFile(); break; case PacketType.StartProcess: processController.StartProcess(); break; case PacketType.KillProcess: processController.KillProcess(); break; case PacketType.InvalidOrEmptyPacket: errorController.InvalidPacket(); break; case PacketType.CheckUpdate: serverController.CheckForUpdate(); break; case PacketType.RefreshCameras: webcamController.RefreshCameras(); break; } } else { errorController.NoAuth(); } }
private void SystemTimer_Tick(object sender, EventArgs e) { DateTime now = DateTime.Now; if (this.ucCheckBox_CloseTime.Checked && ((int)(now.TimeOfDay.TotalSeconds)).Equals((int)this.CloseTime.TimeOfDay.TotalSeconds)) { MessageBox.Show("系统将于60s后自动关机,请及时关闭保存文件!", "番茄钟", MessageBoxButtons.OK, MessageBoxIcon.Information); CancelShutDown = new CancellationTokenSource(); new Thread(() => { int count = 0; this.Invoke(new Action(() => { this.timer.Enabled = true; this.btn_Play_Click(null, null); this.player.Stop(); })); while (count < 60) { count++; if (CancelShutDown.IsCancellationRequested == true) { return; } this.WorkingState.Text = String.Format("{0}S后关闭系统", 60 - count); Thread.Sleep(1000); } if (MessageBox.Show("系统即将关机,请确认文件是否全部保存确定立即关机,取消进入休眠模式!", "番茄钟", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { WindowsController.ExitWindows(RestartOptions.PowerOff, false); } else { WindowsController.ExitWindows(RestartOptions.Hibernate, false); } }).Start(); } string flag = ""; if (now.Hour > 0 && now.Hour <= 5) { flag = "凌晨"; } else if (now.Hour > 5 && now.Hour <= 7) { flag = "早晨"; } else if (now.Hour > 7 && now.Hour <= 11) { flag = "上午"; } else if (now.Hour > 11 && now.Hour <= 13) { flag = "中午"; } else if (now.Hour > 13 && now.Hour <= 17) { flag = "下午"; } else if (now.Hour > 17 && now.Hour <= 19) { flag = "傍晚"; } else if (now.Hour > 19 && now.Hour <= 23) { flag = "晚上"; } else if (now.Hour > 23 && now.Hour <= 0) { flag = "子夜"; } this.label1.Text = now.Year.ToString() + "/" + now.Month.ToString() + "/" + now.Day.ToString() + " " + flag + now.Hour.ToString("D2") + ":" + now.Minute.ToString("D2") + ":" + now.Second.ToString("D2"); if ((now.Minute == 0 || now.Minute == 30) && now.Second == 20) { new Thread(() => { string minutes = ""; if (now.Minute == 30) { minutes = "半"; } TTSUtils.SayChinese("现在是:" + flag + (now.Hour % 12).ToString() + "点" + minutes); }).Start(); } }
/* * private void button2_MouseHover(object sender, EventArgs e) * { * SignupButton.BackColor = Color.White; * SignupButton.ForeColor = Color.FromArgb(255, 128, 0); * } * * private void button2_MouseLeave(object sender, EventArgs e) * { * SignupButton.BackColor = Color.FromArgb(255, 128, 0); * SignupButton.ForeColor = Color.White; * } */ private void LoginButton_Click(object sender, EventArgs e) { WindowsController.checkLogin(this, parent); }
/// <summary> /// //Restart System /// </summary> public static void Restart() { WindowsController.ExitWindows(RestartOptions.Reboot, true); }
private void button1_Click(object sender, EventArgs e) { WindowsController.showLogInWindow(this); }
/// <summary> /// //Hibernate system /// </summary> public static void hibernate() { WindowsController.ExitWindows(RestartOptions.Hibernate, true); }
public void takeQuiz() { WindowsController.showQuizForm(this); }
/// <summary> /// //Suspend System /// </summary> public static void Suspend() { WindowsController.ExitWindows(RestartOptions.Suspend, true); }
protected void SafeExitWindowsThread(RestartOptions how, bool force, WindowsController.AfterExitWindowsHandler after) { Log.Debug("PSClientPlugin: Shutdown thread is running: {0}, force: {1}", how, force); _isSuspendInProgress = true; Log.Debug("PSClientPlugin: Informing handlers about UserShutdownNow"); UserShutdownNow(); // user is away, so we set _lastUserTime long time in the past to pretend that he didn't access system a long time _lastUserTime = DateTime.MinValue; // test if shutdown is allowed bool disallow = DisAllowShutdown; Log.Info("PSClientPlugin: Shutdown is allowed {0} ; forced: {1}", !disallow, force); if (disallow && !force) { lock (this) { // allow further requests _ignoreSuspendUntil = DateTime.MinValue; } if (after != null) { after(how, force, false); } _isSuspendInProgress = false; return; } SetWakeupTimer(); // activate standby _denySuspendQuery = false; Log.Info("PSClientPlugin: Entering shutdown {0} ; forced: {1}", (RestartOptions)how, force); SafeExitWindowsThreadAfterProxy env = new SafeExitWindowsThreadAfterProxy(); env.that = this; env.after = after; _defaultExitWindows((RestartOptions)how, force, env.SafeExitWindowsThreadAfter); }
public VsGuiCore() { WindowsController = new WindowsController(this); }
/// <summary> /// //Log system off /// </summary> public static void Log_off() { WindowsController.ExitWindows(RestartOptions.LogOff, true); }
private void Timer_Count_Tick(object sender, EventArgs e) { WindowsController.ExitWindows(RestartOptions.PowerOff, true); }