private void AddOrUpdateExecutedCommands(YiiCommandEnum command, IDictionary <string, string> commandParams = null) { if (_executedCommands.Any(c => c.Command == command)) { //TODO update dictionary } else { _executedCommands.Add(new YiiCommand { Command = command, CommandParams = commandParams, Action = null }); } }
private IRestResponse ApiRequest(YiiCommandEnum commandKey, IDictionary <string, string> commandParams) { var _client = new RestClient(ApiUrl); var resource = new StringBuilder($"{commandKey}"); if (commandParams != null && commandParams.Any()) { resource.Append("?"); foreach (var parameter in commandParams) { resource.Append($"{parameter.Key}={parameter.Value}&"); } } var request = new RestRequest(resource.ToString().TrimEnd('&').ToLowerInvariant()); return(_client.Execute(request)); }
public void LoopCommand(int period, YiiCommandEnum command, IDictionary <string, string> commandParams = null) { _timer.Change(0, period); AddOrUpdateExecutedCommands(command, commandParams); }