Beispiel #1
0
 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
         });
     }
 }
Beispiel #2
0
        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));
        }
Beispiel #3
0
 public void LoopCommand(int period, YiiCommandEnum command, IDictionary <string, string> commandParams = null)
 {
     _timer.Change(0, period);
     AddOrUpdateExecutedCommands(command, commandParams);
 }