Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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());
        }
Ejemplo n.º 3
0
        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;
 }