示例#1
0
        protected static void ExitWindowsDefaultThread(object _data)
        {
            ExitWindowsDefaultEnv env = (ExitWindowsDefaultEnv)_data;
            RestartOptions        how = env.how;
            bool force = env.force;

            Log.Debug("WindowsController: Performing ExitWindows {0}, force: {1}", how, force);
            bool res;

            switch (how)
            {
            case RestartOptions.Suspend:
                res = Application.SetSuspendState(PowerState.Suspend, force, false);
                break;

            case RestartOptions.Hibernate:
                res = Application.SetSuspendState(PowerState.Hibernate, force, false);
                break;

            default:
                res = ExitWindowsInt((int)how, force);
                break;
            }
            Log.Debug("WindowsController: ExitWindows performed, result: {0}", res);
            if (env.after != null)
            {
                env.after(how, force, res);
            }
        }
示例#2
0
        /// <summary>
        /// Default ExitWindows. Kicks off a thread which handles t
        /// </summary>
        /// <param name="how"></param>
        /// <param name="force"></param>
        /// <returns></returns>
        protected static void ExitWindowsDefault(RestartOptions how, bool force, AfterExitWindowsHandler after)
        {
            ExitWindowsDefaultEnv env = new ExitWindowsDefaultEnv();

            env.how   = how;
            env.force = force;
            env.after = after;
            Thread exitWinThread = new Thread(ExitWindowsDefaultThread);

            exitWinThread.Name = "WinController exit thread";
            exitWinThread.Start(env);
        }
示例#3
0
        /// <summary>
        /// Default ExitWindows. Kicks off a thread which handles t
        /// </summary>
        /// <param name="how"></param>
        /// <param name="force"></param>
        /// <returns></returns>
        protected static void ExitWindowsDefault(RestartOptions how, bool force, AfterExitWindowsHandler after)
        {
            ExitWindowsDefaultEnv env = new ExitWindowsDefaultEnv();

            env.how   = how;
            env.force = force;
            env.after = after;
            // If restart is Hibernate or Suspend then do is async
            if (how == RestartOptions.Hibernate || how == RestartOptions.Suspend)
            {
                (new Thread(ExitWindowsDefaultThread)).Start(env);
            }
            else
            {
                ExitWindowsDefaultThread(env);
            }
        }
示例#4
0
 /// <summary>
 /// Default ExitWindows. Kicks off a thread which handles t
 /// </summary>
 /// <param name="how"></param>
 /// <param name="force"></param>
 /// <returns></returns>
 protected static void ExitWindowsDefault(RestartOptions how, bool force, AfterExitWindowsHandler after)
 {
     ExitWindowsDefaultEnv env = new ExitWindowsDefaultEnv();
       env.how = how;
       env.force = force;
       env.after = after;
       // If restart is Hibernate or Suspend then do is async
       if (how == RestartOptions.Hibernate || how == RestartOptions.Suspend)
     (new Thread(ExitWindowsDefaultThread)).Start(env);
       else
     ExitWindowsDefaultThread(env);
 }
 /// <summary>
 /// Default ExitWindows. Kicks off a thread which handles t
 /// </summary>
 /// <param name="how"></param>
 /// <param name="force"></param>
 /// <returns></returns>
 protected static void ExitWindowsDefault(RestartOptions how, bool force, AfterExitWindowsHandler after)
 {
   ExitWindowsDefaultEnv env = new ExitWindowsDefaultEnv();
   env.how = how;
   env.force = force;
   env.after = after;
   Thread exitWinThread = new Thread(ExitWindowsDefaultThread);
   exitWinThread.Name = "WinController exit thread";
   exitWinThread.Start(env);
 }