private void HandleCommandEvent(TelloCommand command) { ICommandReader reader = commandReaders.SingleOrDefault(t => t.Id == command.Id); IEventCommand evt = reader?.Read(command); if (evt == null) { return; } CommandReceived?.Invoke(this, evt); }
public ICommandRunner ReadCommand(IEventCommand command) { if (command.EventCommandCode == EventCommandCode.Message) { var commandData = command as Message; return(new MessageRunner(processor.messageText, commandData.Text)); } if (command.EventCommandCode == EventCommandCode.SetVariable) { var commandData = command as SetVariableBase; return(new SetVariableRunner(processor.eventID, commandData)); } if (command.EventCommandCode == EventCommandCode.ChoiceStart) { var commandData = command as ChoiceStart; } return(new BlankRunner()); }
private static void EventThreadMain(object state) { EventThreadState eventState = (EventThreadState)state; BlockingCollection <TelloCommand> queue = eventState.Queue; isActive = true; while (isActive) { TelloCommand command = null; try { command = queue.Take(); } catch (InvalidOperationException) { Thread.Sleep(100); } if (command == null) { continue; } ICommandReader reader = commandReaders.SingleOrDefault(t => t.Id == command.Id); IEventCommand evt = reader?.Read(command); if (evt == null) { continue; } } }
public EventController(IEventCommand eventCommand, IEventQuery eventQuery) { _eventCommand = eventCommand; _eventQuery = eventQuery; }