Beispiel #1
0
        private static void KeepWindowsSystemActive()
        {
            // This function calls unmanaged API in order to tell Windows OS that it should not enter sleep state while the program is running
            // If user wishes to enter sleep mode, then he should use ShutdownOnFarmingFinished or manage ASF process with third-party tool or script
            // More info: https://msdn.microsoft.com/library/windows/desktop/aa373208(v=vs.85).aspx
            EExecutionState result = SetThreadExecutionState(EExecutionState.Continuous | EExecutionState.AwayModeRequired | EExecutionState.SystemRequired);

            // SetThreadExecutionState() returns NULL on failure, which is mapped to 0 (EExecutionState.Error) in our case
            if (result == EExecutionState.Error)
            {
                ASF.ArchiLogger.LogGenericError(string.Format(Strings.WarningFailedWithError, result));
            }
        }
Beispiel #2
0
 private static extern EExecutionState SetThreadExecutionState(EExecutionState executionState);
Beispiel #3
0
 internal static extern EExecutionState SetThreadExecutionState(EExecutionState executionState);
 private static extern EExecutionState SetThreadExecutionState(EExecutionState esFlags);