public List <Command_Json> GetCommands(String externalControlAssociationToken) { List <Command_Json> commandList = new List <Command_Json>(); if (externalControlAssociationToken != CurrentExternalControlAssociationToken.ToString() || _viewerAuthenticationInfo == null) { commandList.Add(new Command_Json(ControllerCommandNames.EndAssociation, null)); return(commandList); } while (_commandQueue.Count > 0) { Command_Json command = _commandQueue.Dequeue(); commandList.Add(command); } if (_isCurrentResetEventRetrievelOnly) { _currentResetEvent.Set(); _isCurrentResetEventRetrievelOnly = false; } return(commandList); }
internal void EnqueueCommand(string commandName, string[] commandArgs, AutoResetEvent messageRecievedResetEvent, bool isCurrentResetEventRetrievelOnly) { _currentResetEvent = null; _currentResponse = new Dictionary <string, string>(); Command_Json command = new Command_Json(commandName, commandArgs); _commandQueue.Enqueue(command); if (messageRecievedResetEvent != null) { _currentResetEvent = messageRecievedResetEvent; _isCurrentResetEventRetrievelOnly = isCurrentResetEventRetrievelOnly; } }