private void ProcessNextCommand(CommandBase command)
        {
            if (command == null)
            {
                // TODO - log
                return;
            }

            var mre = new ManualResetEvent(false);

            _configuration.UiDispatcher.BeginInvoke(
                () =>
            {
                command.Configuration = _configuration;
                command.Do();
                mre.Set();
            });
            mre.WaitOne();

            if (command is NullCommand)
            {
                Thread.Sleep(NullCommandSleepTimeoutInMilliseconds);
                return;
            }
        }
Ejemplo n.º 2
0
        public void Do(CommandBase com)
        {
            MyGame.DebugAlert(DebugMode.Commands, "Doing " + com.ToString(MyGame));

            if (!(com is CommandGroup))
            {
                UndoStack.Push(com);
            }

            com.Do(MyGame);

            if (!SuspendViewUpdates)
            {
                com.UpdateViews(MyGame);
            }

            if (triggerOnCommandTypes.Contains(com.GetType()) && !IsLoading)
            {
                MyGame.MyTriggerHandler.GatherTriggers(com);
            }

            CommandPerformed?.Invoke(com);
        }