コード例 #1
0
        private void Suspend()
        {
            try
            {
                wup = new WakeUP();
                bool result = wup.SetWakeUpTime(dtWakeUp);

                System.Threading.Thread.Sleep(1000);

                if (result == false)
                {
                    MessageBox.Show("Error: SetWakeUpTime");
                    return;
                }

                Application.SetSuspendState(PowerState.Hibernate, false, false);

#if DEBUG
                dtSleep  = dtSleep.AddMinutes(3);
                dtWakeUp = dtWakeUp.AddMinutes(3);
#else
                dtSleep  = dtSleep.AddDays(1);
                dtWakeUp = dtWakeUp.AddDays(1);
#endif
            }
            catch (Exception ex)
            {
                string err = ex.Message + "\r\n" + ex.StackTrace;
                Debug.WriteLine(err);
            }
        }
コード例 #2
0
 public void Stop()
 {
     try
     {
         timerMain.Stop();
         wup = null;
     }
     catch (Exception ex)
     {
         string err = ex.Message + "\r\n" + ex.StackTrace;
         Debug.WriteLine(err);
     }
 }