private static void TryMakeStop(string clientCode, ClientCommandStutas status) { if (status.IsStopWait) { ServerListener.ConnectedClients.FirstOrDefault(c => c.ClientCode == clientCode)?.SendCommand(ControlCommand.Stop); status.UpdateLastCommand(ControlCommand.Stop); } }
private static bool IsCommandCanSend(string clientCode, ControlCommand command, out ClientCommandStutas status) { lock (LastSendCommands) { if (!LastSendCommands.ContainsKey(clientCode)) { LastSendCommands.Add(clientCode, new ClientCommandStutas(clientCode)); } status = LastSendCommands[clientCode]; return(status.IsCommandCanSend(command)); } }