Example #1
0
 public ShutdownCommand(
     IPowerController powerController,
     ShutdownArgs shutdownArgs)
 {
     this.powerController = powerController;
     this.shutdownArgs    = shutdownArgs;
 }
 private Task onShuttingDown(ShutdownArgs arg)
 {
     foreach (GameInfos game in m_games)
         if (game.Playing)
             m_clientAPI.DeleteScene(game.SceneName);
     return Task.FromResult(true);
 }
 internal async Task SceneShuttingDown(ShutdownArgs arg)
 {
     foreach (var rq in _runningInternalRequests.Values.ToArray())
     {
         rq.ctx.SendError("Scene shutting down");
     }
     await Task.FromResult(true);
 }
Example #4
0
        public void ScheduleShutdown(ShutdownArgs shutdownArgs)
        {
            string args = new ShutdownCommandArgumentsBuilder()
                          .Seconds(shutdownArgs.Seconds)
                          .OverrideExistingShutdown(shutdownArgs.OverrideExistingShutdown)
                          .ShowNotification(shutdownArgs.ShowNotification)
                          .Build();

            CmdLineUtils.InvokeCommandLineCommand(args);
        }
Example #5
0
 private void shutdownAllToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Shut down all computers where Dirigent is running?", "Dirigent", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
     {
         var args = new ShutdownArgs()
         {
             Mode = EShutdownMode.PowerOff
         };
         _ctrl.Send(new Net.ShutdownMessage(_ctrl.Name, args));
     }
 }
Example #6
0
 private async Task OnChatShuttingdown(ShutdownArgs args)
 {
     ChatShutdownContext chatShutdown = new ChatShutdownContext(MessagesObservable);
     await _chatEventHandler?.RunEventHandler(eh =>
     {
         return(eh.OnShutDown(chatShutdown));
     }, ex =>
     {
         _log.Log(LogLevel.Error, _logCategory, "An error occured when the chat service try to dispose observable.", ex);
         throw new ClientException($"An error occured when the chat service try to dispose observable.");
     });
 }
 private async Task onShutdown(ShutdownArgs arg)
 {
     _scene.GetComponent <ILogger>().Debug("main", "the scene shuts down");
     _isRunning = false;
     try
     {
         await _gameLoop;
     }
     catch (Exception e)
     {
         _scene.GetComponent <ILogger>().Log(LogLevel.Error, "runtimeError", "an error occurred in the game loop", e);
     }
 }
Example #8
0
        static void ShutdownCallback(SchedulerTask task)
        {
            ShutdownArgs args = (ShutdownArgs)task.State;

            if (args.Delay == 0)
            {
                Server.Stop(false, args.Reason);
            }
            else
            {
                Log("Server shutdown in " + args.Delay + " seconds");
                args.Delay--;
            }
        }
        private async Task onShutdown(ShutdownArgs arg)
        {
            _scene.GetComponent<ILogger>().Debug("main", "the scene shuts down");
            _isRunning = false;
            try
            {
                await _gameLoop;

            }
            catch (Exception e)
            {
                _scene.GetComponent<ILogger>().Log(LogLevel.Error, "runtimeError", "an error occurred in the game loop", e);
            }
        }
Example #10
0
        static void ShutdownCallback(SchedulerTask task)
        {
            ShutdownArgs args = (ShutdownArgs)task.State;

            if (args.Delay == 0)
            {
                MCGalaxy.Gui.App.ExitProgram(false, args.Reason);
            }
            else
            {
                Log("Server shutdown in " + args.Delay + " seconds");
                args.Delay--;
                task.State = args;
            }
        }
Example #11
0
        static void DoShutdown(int delay, string reason)
        {
            ShutdownArgs args = new ShutdownArgs();

            args.Delay  = delay - 1;
            args.Reason = reason;

            if (reason.Length > 0)
            {
                reason = ": " + reason;
            }
            Log("Server shutdown started" + reason);
            Log("Server shutdown in " + delay + " seconds");

            shutdownTask = Server.MainScheduler.QueueRepeat(
                ShutdownCallback, args, TimeSpan.FromSeconds(1));
        }
Example #12
0
        static void ShutdownCallback(SchedulerTask task)
        {
            ShutdownArgs args = (ShutdownArgs)task.State;

            if (args.Delay == 0)
            {
                string reason = args.Reason;
                if (reason.Length == 0)
                {
                    reason = Server.Config.DefaultShutdownMessage;
                }
                Server.Stop(false, reason);
            }
            else
            {
                Log("Server shutdown in " + args.Delay + " seconds");
                args.Delay--;
            }
        }
Example #13
0
        public override void Execute()
        {
            var argsStruct = new ShutdownArgs()
            {
            };

            var argsDict = Tools.ParseKeyValList(args);

            string modeStr;

            if (Tools.TryGetValueIgnoreKeyCase(argsDict, "mode", out modeStr))
            {
                if (!Tools.GetEnumValueByNameIgnoreCase <EShutdownMode>(modeStr, out argsStruct.Mode))
                {
                    throw new ArgumentException(String.Format("invalid mode '{0}'", modeStr), "mode");
                }
            }

            ctrl.Shutdown(_requestorId, argsStruct);
            WriteResponse("ACK");
        }
Example #14
0
 public ShutdownMessage(string requestorId, ShutdownArgs args)
 {
     this.Sender = requestorId;
     this.Args   = args;
 }
 private async Task OnShutDown(ShutdownArgs arg)
 {
     _isRunning = false;
     await _queueTask;
 }
Example #16
0
 private async Task OnShutDown(ShutdownArgs arg)
 {
     _isRunning = false;
     await _queueTask;
 }
Example #17
0
 public void ScheduleShutdown(ShutdownArgs arguments)
 {
     logger.LogInformation($"Shutdown was called with args: {arguments}");
     SecondsTillShutdown = arguments.Seconds;
 }
 private Task onShutdown(ShutdownArgs arg)
 {
     m_running = false;
     return Task.FromResult(true);
 }
Example #19
0
 public Task OnShutdown(ShutdownArgs args)
 {
     if (_periodicUpdateTask != null)
     {
         _periodicUpdateTask.Dispose();
     }
     return Task.FromResult(true);
 }