packages/Windows API Code Pack 1.1/source/WindowsAPICodePack/Core/PowerManagement/PowerManager.cs
/// <summary>
/// Allows an application to inform the system that it 
/// is in use, thereby preventing the system from entering 
/// the sleeping power state or turning off the display 
/// while the application is running.
/// </summary>
/// <param name="executionStateOptions">The thread's execution requirements.</param>
/// <exception cref="Win32Exception">Thrown if the SetThreadExecutionState call fails.</exception>
Allows an application to inform the system that it
is in use, thereby preventing the system from entering
the sleeping power state or turning off the display
while the application is running.
Allows an application to inform the system that it is in use thereby preventing the system from entering the sleeping power state or turning off the display while the application is running .
public static void SetThreadExecutionState(ExecutionStates executionStateOptions)
        {
            ExecutionStates ret = PowerManagementNativeMethods.SetThreadExecutionState(executionStateOptions);
            if (ret == ExecutionStates.None)
            {
                throw new Win32Exception(LocalizedMessages.PowerExecutionStateFailed);
            }
        }
public static void SetThreadExecutionState ( ExecutionStates executionStateOptions ) { ExecutionStates ret = PowerManagementNativeMethods . SetThreadExecutionState ( executionStateOptions ) ; if ( ret == ExecutionStates . None ) { throw new Win32Exception ( LocalizedMessages . PowerExecutionStateFailed ) ; } }
Allows an application to inform the system that it
is in use, thereby preventing the system from entering
the sleeping power state or turning off the display
while the application is running.
Allows an application to inform the system that it is in use thereby preventing the system from entering the sleeping power state or turning off the display while the application is running .
Thrown if the SetThreadExecutionState call fails.
Thrown if the SetThreadExecutionState call fails .
executionStateOptions
ExecutionStates
The thread's execution requirements.
The thread ' s execution requirements .