Esempio n. 1
0
 private static void SetState(EXECUTION_STATE state)
 {
     Logger.Info("Setting System State to [{0}]", EXECUTION_STATE.ES_CONTINUOUS);
     try
     {
         SetThreadExecutionState(state);
     }
     catch (Exception e)
     {
         Logger.Error("An error has occurred while setting system state. {0}", e.ToString());
     }
 }
Esempio n. 2
0
        private void PreventSleep()
        {
            var lastState = SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS
                | EXECUTION_STATE.ES_DISPLAY_REQUIRED
                | EXECUTION_STATE.ES_SYSTEM_REQUIRED
                | EXECUTION_STATE.ES_AWAYMODE_REQUIRED);//Away mode for Windows >= Vista
            if (lastState == EXECUTION_STATE.ES_INVALID)
            {
                lastState = SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS
                    | EXECUTION_STATE.ES_DISPLAY_REQUIRED
                    | EXECUTION_STATE.ES_SYSTEM_REQUIRED); //Windows < Vista, forget away mode
            }

            if (m_initialExcutionState == EXECUTION_STATE.ES_INVALID)
            {
                m_initialExcutionState = lastState;
            }
        }
Esempio n. 3
0
 private static extern UInt32 CallNtPowerInformation(POWER_INFORMATION_LEVEL InformationLevel, IntPtr lpInputBuffer, UInt32 nInputBufferSize, out EXECUTION_STATE lpOutputBuffer, Int32 nOutputBufferSize);
Esempio n. 4
0
 protected static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE state);
Esempio n. 5
0
 static extern uint SetThreadExecutionState(EXECUTION_STATE esFlags);
Esempio n. 6
0
 [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE esFlags);
Esempio n. 7
0
 private extern static EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE state);
Esempio n. 8
0
 private static extern EXECUTION_STATE SetThreadExecutionStateNative(EXECUTION_STATE esFlags);
Esempio n. 9
0
 internal static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE state);
 static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE flags); 
 public void Execute(object o = null)
 {
     Initialized        = true;
     LastExecutionState = WinAPI.SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS | EXECUTION_STATE.ES_SYSTEM_REQUIRED | EXECUTION_STATE.ES_DISPLAY_REQUIRED);
     Program.Reader.ReadAsync("Hibernation denied.");
 }
Esempio n. 12
0
 internal static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE state);
Esempio n. 13
0
	public static EXECUTION_STATE SetThreadExecutionState (EXECUTION_STATE esFlags)
	{
		Console.WriteLine ("Kernel32:SetThreadExecutionState called");
		return EXECUTION_STATE.ES_CONTINUOUS;
	}
Esempio n. 14
0
 public NonSuspendableAction()
 {
     // Forces the system to be in the working state until next call that uses ES_CONTINUOUS:
     previousState = Kernel32.SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS | EXECUTION_STATE.ES_SYSTEM_REQUIRED);
 }
Esempio n. 15
0
 static extern uint SetThreadExecutionState(EXECUTION_STATE esFlags);
Esempio n. 16
0
 private extern static EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE state);
Esempio n. 17
0
 public EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE esFlags)
 {
     return(SetThreadExecutionStateNative(esFlags));
 }
Esempio n. 18
0
 public static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE esFlags);
Esempio n. 19
0
 public static void ResetStandbyTimer()
 {
     EXECUTION_STATE es = SetThreadExecutionState(EXECUTION_STATE.ES_DISPLAY_REQUIRED | EXECUTION_STATE.ES_SYSTEM_REQUIRED);
 }
 public NonSuspendableAction()
 {
     // Forces the system to be in the working state until next call that uses ES_CONTINUOUS:
     previousState = Kernel32.SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS | EXECUTION_STATE.ES_SYSTEM_REQUIRED);
 }
Esempio n. 21
0
 private static extern EXECUTION_STATE SetThreadExecutionState(
     EXECUTION_STATE flags);
Esempio n. 22
0
 public static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE esFlags);
Esempio n. 23
0
 protected static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE state);