private async Task HandleCommandAsync <T>(T command) where T : IWardenCommand { var commandName = command.GetType().Name; _logger.Trace($"Executing command {commandName}."); if (command is PingWarden) { await PingAsync(); } else if (command is StopWarden) { _isWardenRunning = false; await _warden.StopAsync(); } else if (command is StartWarden) { _isWardenRunning = true; await _warden.StartAsync(); } else if (command is PauseWarden) { _isWardenRunning = false; await _warden.PauseAsync(); } else if (command is KillWarden) { await PublishCommandExecutedEvent(commandName); Process.GetCurrentProcess().Kill(); } await PublishCommandExecutedEvent(commandName); }
public async Task PauseAsync() { await Warden.PauseAsync(); LogMessage("Warden service has been paused.", MessageType.Info); }
public async Task PauseAsync() { await Warden.PauseAsync(); Console.WriteLine("Warden service has been paused."); }