public int GetCommandType() { Log.Debug("GetCommandType: called."); _currentTask = DequeueTask(); return(_currentTask?.Command?.CommandType ?? 0); }
public void SendResponse(MtResponse response) { Log.DebugFormat("SendResponse: begin. response = {0}", response); _currentTask.SetResult(response); _currentTask = null; Log.Debug("SendResponse: end."); }
public void Execute(MtCommandTask task) { lock (_taskQueue) { _taskQueue.Enqueue(task); } NotifyCommandReady(); }
public void SendResponse(MtResponse response) { Log.DebugFormat("SendResponse: begin. response = {0}", response); _commandTask.SetResult(response); _commandTask = null; FireOnCommandExecuted(); Log.Debug("SendResponse: end."); }
public int GetCommandType() { Log.Debug("GetCommandType: called."); var commandManager = CommandManager; if (commandManager != null) { _commandTask = commandManager.DequeueCommandTask(); } return(_commandTask?.Command?.CommandType ?? 0); }
public void EnqueueCommandTask(MtCommandTask task) { if (task == null) { return; } lock (_locker) { _commandTasks.Enqueue(task); } NotifyCommandReady(); }
public MtResponse SendCommand(MtCommand command) { MtResponse response = null; if (command != null) { var task = new MtCommandTask(command); _executorManager.EnqueueCommandTask(task); //wait for execute command in MetaTrader response = task.WaitResult(WAIT_RESPONSE_TIME); } return(response); }
public void EnqueueCommandTask(MtCommandTask task) { if (task == null) { throw new ArgumentNullException(nameof(task)); } Log.DebugFormat("EnqueueCommandTask: begin. task = {0}", task); lock (_locker) { _commandTasks.Enqueue(task); } NotifyCommandReady(); Log.Debug("EnqueueCommandTask: end."); }
public MtResponse SendCommand(MtCommand command) { Log.DebugFormat("SendCommand: begin. command {0}", command); if (command == null) { Log.Warn("SendCommand: end. command is not defined"); return(null); } var task = new MtCommandTask(command); _executorManager.EnqueueCommandTask(task); //wait for execute command in MetaTrader var response = task.WaitResult(WaitResponseTime); return(response); }
public MtCommandTask SendCommand(MtCommand command) { if (command == null) { throw new ArgumentNullException(nameof(command)); } var task = new MtCommandTask(command); Log.DebugFormat("SendTask: begin. command = {0}", command); ITaskExecutor executor; lock (_locker) { if (_executorMap.ContainsKey(command.ExpertHandle)) { executor = _executorMap[command.ExpertHandle]; } else { executor = _executorList.Count > 0 ? _executorList[0] : null; } } if (executor == null) { Log.Error("SendTask: Executor is null!"); } else { executor.Execute(task); } Log.Debug("SendTask: end."); return(task); }