public FormShutdown(ShutdownType type)
 {
     action = type;
     InitializeComponent();
     switch (action)
     {
         case ShutdownType.Shutdown:
             this.Text = "关机";
             this.lblDescribe.Text = "系统将在以下时间内关机";
             break;
         case ShutdownType.Logoff:
             this.Text = "注销";
             this.lblDescribe.Text = "系统将在以下时间内注销";
             break;
         case ShutdownType.Reboot:
             this.Text = "重新启动";
             this.lblDescribe.Text = "系统将在以下时间内重新启动";
             break;
         case ShutdownType.Hibernate:
             this.Text = "休眠";
             this.lblDescribe.Text = "系统将在以下时间内休眠";
             break;
         case ShutdownType.Suspend:
             this.Text = "待机";
             this.lblDescribe.Text = "系统将在以下时间内待机";
             break;
     }
 }
Exemple #2
0
        public void ToTray(ShutdownType ShutdownType)
        {
            notify.Icon = Properties.Resources.favicon;
            notify.BalloonTipText =  ShutdownType + " in " + (timer.Interval / 60000).ToString() + " minutes.";
            notify.BalloonTipTitle = "Shutdown";
            notify.Text = "Shutdown";
            notify.Visible = true;

            notify.ShowBalloonTip(500);

            if (form.InvokeRequired)
            {
                hideform hidedelegate = () => form.Hide();
                form.Invoke(hidedelegate);
            }
            else form.Hide();
        }
Exemple #3
0
 /// <summary>
 ///     Shuts down a region and removes it from all running modules
 /// </summary>
 /// <param name="type"></param>
 /// <param name="seconds"></param>
 /// <returns></returns>
 public void CloseRegion(IScene scene, ShutdownType type, int seconds)
 {
     if (type == ShutdownType.Immediate)
     {
         scene.Close(true);
         if (OnCloseScene != null)
         {
             OnCloseScene(scene);
         }
         CloseModules(scene);
         m_scenes.Remove(scene);
     }
     else
     {
         Timer t = new Timer(seconds * 1000); //Millisecond conversion
         t.Elapsed  += (sender, e) => CloseRegion(scene, ShutdownType.Immediate, 0);
         t.AutoReset = false;
         t.Start();
     }
 }
Exemple #4
0
        public IActionResult shutdown(ShutdownModel sd)
        {
            var api = Api.INSTANCE;

            api.DemandAdmin(Request);

            ShutdownType type = ShutdownType.SHUTDOWN;

            if (sd.update)
            {
                type = ShutdownType.UPDATE;
            }
            else if (sd.restart)
            {
                type = ShutdownType.RESTART;
            }

            api.RequestShutdown((uint)sd.timeout, type);

            return(ApiResponse.Json(HttpStatusCode.OK, true));
        }
        /// <summary>
        /// 关闭游戏框架。
        /// </summary>
        /// <param name="shutdownType">关闭游戏框架类型。</param>
        public static void Shutdown(ShutdownType shutdownType)
        {
            Log.Info("Shutdown Game Framework ({0})...", shutdownType.ToString());
            BaseComponent baseComponent = GetComponent <BaseComponent>();

            if (baseComponent != null)
            {
                baseComponent.Shutdown();
            }

            s_GameFrameworkComponents.Clear();

            if (shutdownType == ShutdownType.Quit)
            {
                Application.Quit();
            }
            else if (shutdownType == ShutdownType.Restart && baseComponent != null)
            {
                baseComponent.Reload();
            }
        }
Exemple #6
0
        public virtual ProgressToken Shutdown(ShutdownType type)
        {
            Trace.Assert(getState() == VBoxWrapper.MachineState.Running);

            comVB.Session session = acquireClientLock();

            switch (type)
            {
            case ShutdownType.ACPI:
                return(acpiShutdown(session));

            case ShutdownType.HardOff:
                return(hardOff(session));

            case ShutdownType.SaveState:
                return(saveState(session));

            default:
                throw new InvalidProgramException("ShutdownType unknown -> Normally never reached...");
            }
        }
        /// <summary>
        /// Shuts down a region and removes it from all running modules
        /// </summary>
        /// <param name="scene"></param>
        /// <param name="type"></param>
        /// <param name="seconds"></param>
        /// <returns></returns>
        public void CloseRegion(IScene scene, ShutdownType type, int seconds)
        {
            if (type == ShutdownType.Immediate)
            {
                InnerCloseRegion(scene);
            }
            else
            {
                Timer t = new Timer(seconds * 1000); //Millisecond conversion
#if (!ISWIN)
                t.Elapsed +=
                    delegate(object sender, ElapsedEventArgs e)
                {
                    CloseRegion(scene, ShutdownType.Immediate, 0);
                };
#else
                t.Elapsed += (sender, e) => CloseRegion(scene, ShutdownType.Immediate, 0);
#endif
                t.AutoReset = false;
                t.Start();
            }
        }
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            ShutdownType shutdownType = ShutdownType.Shutdown;

            switch (value.ToString())
            {
            case "Hibernate":
                shutdownType = ShutdownType.Hibernate;
                break;

            case "Sleep":
                shutdownType = ShutdownType.Sleep;
                break;

            case "Restart":
                shutdownType = ShutdownType.Restart;
                break;

            case "Log Off":
                shutdownType = ShutdownType.LogOff;
                break;
            }
            return(shutdownType);
        }
Exemple #9
0
        public void Shutdown(Authentication authentication, int milliseconds, ShutdownType shutdownType, string message)
        {
            this.DebugMethod(authentication, this, nameof(Shutdown), this, milliseconds, shutdownType, message);
            if (authentication.Types.HasFlag(AuthenticationType.Administrator) == false)
            {
                throw new PermissionDeniedException();
            }
            if (milliseconds < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(milliseconds), "invalid milliseconds value");
            }

            if (string.IsNullOrEmpty(message) == false)
            {
                this.userContext.Dispatcher.InvokeAsync(() => this.userContext.NotifyMessage(Authentication.System, message));
            }

            if (this.shutdownTimer == null)
            {
                this.shutdownTimer = new ShutdownTimer()
                {
                    Interval = 1000,
                };
                this.shutdownTimer.Elapsed += ShutdownTimer_Elapsed;
            }

            var dateTime = DateTime.Now.AddMilliseconds(milliseconds);

            this.shutdownTimer.DateTime     = dateTime;
            this.shutdownTimer.ShutdownType = shutdownType;
            this.shutdownTimer.Start();
            if (milliseconds >= 1000)
            {
                this.SendShutdownMessage((dateTime - DateTime.Now) + new TimeSpan(0, 0, 0, 0, 500), true);
            }
        }
Exemple #10
0
        /// <summary>
        /// 关闭游戏
        /// </summary>
        /// <param name="shutdownType">关闭游戏类型</param>
        public static void Shutdown(ShutdownType shutdownType)
        {
            Log.Info("Shutdown ({0})...", shutdownType.ToString());

            if (shutdownType == ShutdownType.None)
            {
                return;
            }

            if (shutdownType == ShutdownType.Restart)
            {
                SceneManager.LoadScene(SceneId);
                return;
            }

            if (shutdownType == ShutdownType.Quit)
            {
                Application.Quit();
#if UNITY_EDITOR
                UnityEditor.EditorApplication.isPlaying = false;
#endif
                return;
            }
        }
Exemple #11
0
 public void Initiate(ShutdownType shutdownType)
 {
     //debounce
     if (!_isShutdownRequested)
     {
         _isShutdownRequested = true;
         _logger.Log(LogLevel.Information, $"{shutdownType} signal received");
         var libraryItem = new LibraryItem(-1, Path.Combine(_appDirectory, ShutdownFileName), _bassActor);
         if (_playerActor.PlaybackState == PlaybackState.Playing || _playerActor.PlaybackState == PlaybackState.Paused)
         {
             _playerActor.Stop();
         }
         if (_playerActor.PlaybackState == PlaybackState.Stopped)
         {
             _playerActor.Play(libraryItem);
         }
         Thread.Sleep(2000);
         var operation = shutdownType == ShutdownType.RestartImmediate ? "reboot" : "shutdown";
         Process.Start(new ProcessStartInfo()
         {
             FileName = "sudo", Arguments = $"{operation} now"
         });
     }
 }
 private void Shutdown_CheckedChanged(object sender, EventArgs e)
 {
     ShutdownType = ShutdownType.Shutdown;
 }
 /// <summary>
 /// Shuts down a region and removes it from all running modules
 /// </summary>
 /// <param name="scene"></param>
 /// <param name="type"></param>
 /// <param name="seconds"></param>
 /// <returns></returns>
 public void CloseRegion (IScene scene, ShutdownType type, int seconds)
 {
     if (type == ShutdownType.Immediate)
     {
         InnerCloseRegion (scene);
     }
     else
     {
         Timer t = new Timer (seconds * 1000);//Millisecond conversion
         t.Elapsed +=
             delegate (object sender, ElapsedEventArgs e)
             {
                 CloseRegion (scene, ShutdownType.Immediate, 0);
             };
         t.AutoReset = false;
         t.Start ();
     }
 }
Exemple #14
0
        /// <summary>
        /// Write log about shutdown event
        /// </summary>
        /// <param name="shutdownType">type of shutdowh</param>
        public static void WriteLog(ShutdownType shutdownType, ShutdownOptions shutdownOptions)
        {
            var pathToLogDirectory = CreateLogDirectoryIfNotExists();          //get path to the log directory

            WriteLogInFile(shutdownType, shutdownOptions, pathToLogDirectory); //write log about shutdown event
        }
Exemple #15
0
 /// <summary>
 /// Disables sends and receives on the <see cref="Socket"/>.
 /// </summary>
 /// <param name="type">
 /// Type: <see cref="yourmt.Sockets.ShutdownType"/>
 /// One of the <see cref="ShutdownType"/> values that specifies the operation that will no longer be allowed.
 /// </param>
 public void Shutdown(ShutdownType type)
 {
     if(WinSock2.shutdown(Handle, type) == WinSock2.SocketError)
         throw new Win32Exception();
 }
Exemple #16
0
 public void SignalInternalShutdown(ShutdownType type)
 {
     OnInternalShutdown?.Invoke(this, type);
 }
Exemple #17
0
 public static bool ScheduleAutoShutdown(string taskKey, string taskSuffix, string command, TimeSpan?restartTime, string profileName, ShutdownType type)
 {
     return(ScheduleAutoShutdown(taskKey, taskSuffix, command, restartTime, DaysOfTheWeek.AllDays, profileName, type));
 }
 public ShutdownMessage(int interval, ShutdownType type)
 {
     this.interval = interval;
     this.type = type;
 }
Exemple #19
0
 public static extern Int32 shutdown(IntPtr s, ShutdownType how);
Exemple #20
0
 public ShutdownMessage(int interval, ShutdownType type)
 {
     this.interval = interval;
     this.type     = type;
 }
 public ProgressToken Shutdown(ShutdownType type) {
     return _innerProxy.Shutdown(type);
 }
Exemple #22
0
 internal AppClosingEventArgs(ShutdownType shutdownType)
     : base(shutdownType)
 {
 }
Exemple #23
0
 internal AppClosedEventArgs(ShutdownType shutdownType)
     : base()
 {
     ShutdownType = shutdownType;
 }
 public void Shutdown(ShutdownType shutdownType)
 {
     Shutdown(shutdownType, null);
 }
Exemple #25
0
        /// <summary>
        /// 退出系统
        /// </summary>
        /// <param name="type">退出参数</param>
        /// <returns>是否成功</returns>
        public static bool ExitWindows(ShutdownType type)
        {
            bool ok;
            TokPriv1Luid tp;
            IntPtr hproc = GetCurrentProcess();
            IntPtr htok = IntPtr.Zero;
            ok = OpenProcessToken(hproc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref htok);
            tp.Count = 1;
            tp.Luid = 0;
            tp.Attr = SE_PRIVILEGE_ENABLED;
            ok = LookupPrivilegeValue(null, SE_SHUTDOWN_NAME, ref tp.Luid);
            ok = AdjustTokenPrivileges(htok, false, ref tp, 0, IntPtr.Zero, IntPtr.Zero);
            ok = ExitWindowsEx((int)type, 0);

            return ok;
        }
 private static extern int Shutdown(
     IntPtr sessionHandle,
     ShutdownType actionFlags,
     WriteStatusCallback statusCallback);
Exemple #27
0
        public static bool ScheduleAutoShutdown(string taskKey, string taskSuffix, string command, TimeSpan?restartTime, DaysOfTheWeek daysOfTheWeek, string profileName, ShutdownType type)
        {
            var taskName   = GetScheduledTaskName(TaskType.AutoShutdown, taskKey, taskSuffix);
            var taskFolder = TaskService.Instance.RootFolder.SubFolders.Exists(TaskFolder) ? TaskService.Instance.RootFolder.SubFolders[TaskFolder] : null;

            if (restartTime.HasValue)
            {
                // create the task folder
                if (taskFolder == null)
                {
                    try
                    {
                        taskFolder = TaskService.Instance.RootFolder.CreateFolder(TaskFolder, null, false);
                    }
                    catch (Exception ex)
                    {
                        _logger.Error($"{nameof(ScheduleAutoShutdown)} - Unable to create the Server Manager task folder. {ex.Message}\r\n{ex.StackTrace}");
                        return(false);
                    }
                }

                if (taskFolder == null)
                {
                    return(false);
                }

                var task           = taskFolder.Tasks.Exists(taskName) ? taskFolder.Tasks[taskName] : null;
                var taskDefinition = task?.Definition ?? TaskService.Instance.NewTask();

                if (taskDefinition == null)
                {
                    return(false);
                }

                Version.TryParse(AppUtils.GetDeployedVersion(), out Version appVersion);

                taskDefinition.Principal.LogonType = TaskLogonType.InteractiveToken;
                taskDefinition.Principal.RunLevel  = TaskRunLevel.Highest;

                taskDefinition.RegistrationInfo.Description = $"Server Auto-Shutdown - {profileName}";
                taskDefinition.RegistrationInfo.Source      = "Server Manager";
                taskDefinition.RegistrationInfo.Version     = appVersion;

                taskDefinition.Settings.ExecutionTimeLimit = TimeSpan.FromHours(EXECUTION_TIME_LIMIT);
                taskDefinition.Settings.Priority           = ProcessPriorityClass.Normal;

                // Add/Edit the trigger that will fire every day at the specified restart time
                var triggers = taskDefinition.Triggers.OfType <WeeklyTrigger>().ToList();
                if (triggers.Count == 0)
                {
                    var trigger = new WeeklyTrigger
                    {
                        StartBoundary      = DateTime.Today.Add(restartTime.Value),
                        ExecutionTimeLimit = TimeSpan.FromHours(EXECUTION_TIME_LIMIT),
                        DaysOfWeek         = daysOfTheWeek,
                    };
                    taskDefinition.Triggers.Add(trigger);
                }
                else
                {
                    foreach (var trigger in triggers)
                    {
                        trigger.StartBoundary = DateTime.Today.Add(restartTime.Value);
                        trigger.DaysOfWeek    = daysOfTheWeek;
                    }
                }

                // remove any old triggers
                var oldTriggers = taskDefinition.Triggers.OfType <DailyTrigger>().ToList();
                if (oldTriggers.Count > 0)
                {
                    foreach (var oldTrigger in oldTriggers)
                    {
                        taskDefinition.Triggers.Remove(oldTrigger);
                    }
                }

                // Create an action that will launch whenever the trigger fires
                var arguments = string.Empty;
                switch (type)
                {
                case ShutdownType.Shutdown1:
                    arguments = Constants.ARG_AUTOSHUTDOWN1;
                    break;

                case ShutdownType.Shutdown2:
                    arguments = Constants.ARG_AUTOSHUTDOWN2;
                    break;

                default:
                    return(false);
                }

                taskDefinition.Actions.Clear();
                var action = new ExecAction
                {
                    Path      = command,
                    Arguments = $"{arguments}{taskKey}"
                };
                taskDefinition.Actions.Add(action);

                try
                {
                    task = taskFolder.RegisterTaskDefinition(taskName, taskDefinition, TaskCreation.CreateOrUpdate, null, null, TaskLogonType.InteractiveToken);
                    return(task != null);
                }
                catch (Exception ex)
                {
                    _logger.Error($"{nameof(ScheduleAutoShutdown)} - Unable to create the ScheduleAutoShutdown task. {ex.Message}\r\n{ex.StackTrace}");
                }
            }
            else
            {
                if (taskFolder == null)
                {
                    return(true);
                }

                // Retrieve the task to be deleted
                var task = taskFolder.Tasks.Exists(taskName) ? taskFolder.Tasks[taskName] : null;
                if (task == null)
                {
                    return(true);
                }

                try
                {
                    // Delete the task
                    taskFolder.DeleteTask(taskName, false);
                    return(true);
                }
                catch (Exception ex)
                {
                    _logger.Error($"{nameof(ScheduleAutoShutdown)} - Unable to delete the ScheduleAutoShutdown task. {ex.Message}\r\n{ex.StackTrace}");
                }
            }

            return(false);
        }
 public ProgressToken Shutdown(ShutdownType type)
 {
     return(_innerProxy.Shutdown(type));
 }
Exemple #29
0
 public override void Deserialize(IoBuffer input, ISerializationContext context)
 {
     ShardId = input.GetUInt32();
     Type    = input.GetEnum <ShutdownType>();
 }
Exemple #30
0
        private void ExecuteShutdown(int milliseconds, ShutdownType st)
        {
            if (st != ShutdownType.Cancel)
            {
                if (milliseconds >= 0)
                {
                    shutdown.ShutdownActionExe(milliseconds, st);
                    Mini.ToTray( st);
                    tick = 1;

                    visualTimer.Interval = 1000;

                    visualTimer.Enabled = true;
                }
                else MessageBox.Show("Time must be positive");
                server.ReportClients(ServerStatus.ShutdownInitiated);
                mainInterface1.toggleActive(ServerStatus.ShutdownInitiated);
            }
            else
            {
                CancelShutdown();
            }
        }
Exemple #31
0
 public int ProcessShutdown(ShutdownType shutdownType)
 {
     return(((delegate * stdcall <ISurrogateService *, ShutdownType, int>)(lpVtbl[7]))((ISurrogateService *)Unsafe.AsPointer(ref this), shutdownType));
 }
        /// <summary>
        /// Executes the requested shutdown
        /// </summary>
        /// <param name="interval">The interval.</param>
        /// <param name="ShutdownType">Type of the shutdown.</param>
        public void ShutdownActionExe(int interval, ShutdownType ShutdownType)
        {
            MyShutdownType = ShutdownType;

            if (interval > 0)
            {
                ShutdownTimer.Interval = interval;
                ShutdownTimer.Tick += new EventHandler(MyTimer_Elapsed);

            }
            else if (interval == 0)
            {
                ShutdownTimer.Interval = 1;
                ShutdownTimer.Tick += new EventHandler(MyTimer_Elapsed);
            }
            else ShutdownTimer.Interval = 1; // interval cannot be 0, so it is set to 1 millisecond instead

            ShutdownTimer.Start();

            if (ShutdownType == ShutdownType.Shutdown) modifier = "s -f -t 0";
            else if (ShutdownType == ShutdownType.Reboot) modifier = "r -f -t 0";
            else if (ShutdownType == ShutdownType.Hibernate) modifier = "h";
        }
Exemple #33
0
        //// Provide CLR accessors for the event
        //public event RoutedEventHandler RoutedPopupClose
        //{
        //    add { AddHandler(WPopupTimer.PopupClose, value); }
        //    remove { RemoveHandler(WPopupTimer.PopupClose, value); }
        //}

        //public static WPopupTimer Current
        //{
        //    get => _current;
        //    set => _current = value;
        //}

        //public static WPopupTimer Last => All.Count > 0 ? All[All.Count - 1] : null;
        //public static bool IsOpened => Last != null;

        //public ICommand CommandCancel
        //{
        //    get => (ICommand)GetValue(CommandCancelProperty);
        //    set => SetValue(CommandCancelProperty, value);
        //}

        ////public ICommand AnimationCompleted
        ////{
        ////    get => (ICommand)GetValue(AnimationCompletedProperty);
        ////    set => SetValue(AnimationCompletedProperty, value);
        ////}
        //public ICommand CommandConfirm
        //{
        //    get => (ICommand)GetValue(CommandConfirmProperty);
        //    set => SetValue(CommandConfirmProperty, value);
        //}

        //public void ClosePopup()
        //{
        //    All.Remove(this);
        //    this.Close();
        //}

        //public void DoPopupAlignment()
        //{
        //    // fade in animation
        //    Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(() =>
        //    {
        //        var source = PresentationSource.FromVisual(this);
        //        var workingArea = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea;
        //        var transform = source.CompositionTarget.TransformFromDevice;
        //        var corner = transform.Transform(new Point(workingArea.Right, workingArea.Bottom));

        //        this.Left = corner.X - this.ActualWidth - 100;
        //        this.Top = corner.Y - this.ActualHeight;
        //    }));
        //}

        //public void PopupCloseDo()
        //{
        //    PopupCloseRaise();
        //}

        //private void CanExecuteTrue(object sender, CanExecuteRoutedEventArgs e)
        //{
        //    e.CanExecute = true;
        //}

        //// This method raises the PopupCloseEvent
        //private void PopupCloseRaise()
        //{
        //    Console.WriteLine("Raising PopupCloseEvent");
        //    RoutedEventArgs newEventArgs = new RoutedEventArgs(WPopupTimer.PopupClose, this);
        //    this.RaiseEvent(newEventArgs);
        //}

        //private void PopupHide(object sender, ExecutedRoutedEventArgs e)
        //{
        //    Console.WriteLine("Starting to hide popup " + this.Name + "...");
        //    this.PopupCloseRaise();
        //}

        private void StartAction()
        {
            // parse action from dropdown value
            TimedActionType timedActionType;

            if (!TimedActionType.TryParse(TimerAction.Text, true, out timedActionType))
            {
                MessageBox.Show("Error parsing TimedActionType!");
                return;
            }

            string nama = TimerName.Text;

            Console.WriteLine("Action for new timer [" + nama + "] was " + timedActionType.ToString());

            // switch on action
            TimedAction action = default;
            string      time   = TimerTime.Text;
            bool        warn   = WarnCheck.IsChecked.Value;

            switch (timedActionType)
            {
            default:
                MessageBox.Show("Doing nothing then..");
                this.PopupCloseAnimated();
                return;

            case TimedActionType.Shutdown:
                ShutdownType sdType = ShutdownType.Shutdown; // TODO get real value
                bool         force  = true;                  // TODO get real value

                action       = new TimedShutdownAction(sdType, force, nama, warn);
                action.image = TimerImages.Shutdown;
                break;

            case TimedActionType.Notification:
                var thetext = "bla";
                action       = new TimedNotificationAction(thetext, nama, warn);
                action.image = TimerImages.Notification;
                break;

            case TimedActionType.Custom:
                // TODO
                //action = new TimedNotificationAction(nama, thetext, warn);
                //action.image = TimerImages.Custom;
                break;
            }

            if (action != default)
            {
                // save last value of old timer in registry
                UtilTimer.Current.Save();

                // create new timer with action associated
                var timer = new UtilTimer(action, time);
                //UtilTimer.Current = timer;

                TimerTicker.ReloadTickerEntries();
            }
            else
            {
                MessageBox.Show("Could not create action, sorry my dude...");
            }

            this.PopupCloseAnimated();
        }
 /// <summary>
 ///     Shuts down a region and removes it from all running modules
 /// </summary>
 /// <param name="type"></param>
 /// <param name="seconds"></param>
 /// <returns></returns>
 public void CloseRegion(IScene scene, ShutdownType type, int seconds)
 {
     if (type == ShutdownType.Immediate)
     {
         scene.Close(true);
         if (OnCloseScene != null)
             OnCloseScene(scene);
         CloseModules(scene);
         m_scenes.Remove(scene);
     }
     else
     {
         Timer t = new Timer(seconds*1000); //Millisecond conversion
         t.Elapsed += (sender, e) => CloseRegion(scene, ShutdownType.Immediate, 0);
         t.AutoReset = false;
         t.Start();
     }
 }
 public void Shutdown(ShutdownType type)
 {
     NativeMethodsHelper.ShutdownSystem(Handle, (int) type);
 }
Exemple #36
0
 private void Reboot_CheckedChanged(object sender, EventArgs e)
 {
     ShutdownType = ShutdownType.Reboot;
 }
Exemple #37
0
 public void Shutdown(ShutdownType type)
 {
     NativeMethodsHelper.ShutdownSystem(Handle, (int)type);
 }
 private void Sleep_CheckedChanged(object sender, EventArgs e)
 {
     ShutdownType = ShutdownType.Hibernate;
 }
Exemple #39
0
 private void Shutdown_CheckedChanged(object sender, EventArgs e)
 {
     ShutdownType = ShutdownType.Shutdown;
 }
Exemple #40
0
 private static extern int ExitWindowsEx(ShutdownType uFlags, ShutdownReason dwReason);
Exemple #41
0
 private void Sleep_CheckedChanged(object sender, EventArgs e)
 {
     ShutdownType = ShutdownType.Hibernate;
 }
		/// <summary>
		///     Shuts down a region and removes it from all running modules
		/// </summary>
		/// <param name="scene"></param>
		/// <param name="type">Immediate or Delayed</param>
		/// <param name="delaySecs">Delay seconds</param>
		/// <param name="killAgents"> Kill any agents in the scene</param>
		/// <returns></returns>
		public void CloseRegion (IScene scene, ShutdownType type, int delaySecs, bool killAgents)
		{
			if (type == ShutdownType.Immediate) {
				scene.Close (killAgents);
				if (OnCloseScene != null)
					OnCloseScene (scene);
				CloseModules (scene);
				m_scenes.Remove (scene);
			} else {
				closeRegionTimer = new Timer (delaySecs * 1000); //Millisecond conversion
				closeRegionTimer.Elapsed += (sender, e) => TimedCloseRegion (scene, killAgents);
				closeRegionTimer.AutoReset = false;
				closeRegionTimer.Start ();
			}
		}
Exemple #43
0
        /// <summary>
        /// Shuts down the terminal server.
        /// </summary>
        /// <param name="type">Type of shutdown requested.</param>
        public void Shutdown(ShutdownType type)
        {
            this.CheckDisposed();

            NativeMethodsHelper.ShutdownSystem(this.Handle, (int)type);
        }
Exemple #44
0
 /// <summary>
 /// 关闭游戏框架
 /// </summary>
 /// <param name="shutDownType"></param>
 public static void ShutDown(ShutdownType shutDownType)
 {
     GameEntry.Shutdown(shutDownType);
 }
Exemple #45
0
 public void RequestShutdown(uint time, ShutdownType type)
 {
     OnRequestShutdown?.Invoke(time, type);
 }
 private void Reboot_CheckedChanged(object sender, EventArgs e)
 {
     ShutdownType = ShutdownType.Reboot;
 }