Example #1
0
 public static void PreventDeepSleep(PDSMode mode)
 {
     if (mode == PDSMode.Start)
     {
         dswatch.Reset();
         dswatch.Start();
     }
     else if (mode == PDSMode.Stop)
     {
         dswatch.Stop();
     }
     if (dswatch.ElapsedMilliseconds > 30000L)
     {
         Imports.SetThreadExecutionState(Imports.EXECUTION_STATE.ES_SYSTEM_REQUIRED);
         PreventDeepSleep(PDSMode.Start);
     }
 }
Example #2
0
        public static void PreventDeepSleep(Utility.PDSMode mode)
        {
            switch (mode)
            {
            case Utility.PDSMode.Start:
                Utility.dswatch.Reset();
                Utility.dswatch.Start();
                break;

            case Utility.PDSMode.Stop:
                Utility.dswatch.Stop();
                break;
            }
            if (Utility.dswatch.ElapsedMilliseconds <= 30000L)
            {
                return;
            }
            int num = (int)Imports.SetThreadExecutionState(Imports.EXECUTION_STATE.ES_SYSTEM_REQUIRED);

            Utility.PreventDeepSleep(Utility.PDSMode.Start);
        }