Exemplo n.º 1
0
        public void Initialize(ILogger logger, ICommandController commandController, ITaskController taskController, TaskResultView taskResultView)
        {
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            if (commandController == null)
            {
                throw new ArgumentNullException("commandController");
            }
            if (taskController == null)
            {
                throw new ArgumentNullException("taskController");
            }
            if (taskResultView == null)
            {
                throw new ArgumentNullException("taskResultView");
            }

            this.logger            = logger;
            this.commandController = commandController;
            this.taskController    = taskController;
            this.taskResultView    = taskResultView;

            try
            {
                commandItemContainer.ItemsSource = commandController.Commands;
            }
            catch (Exception ex)
            {
                logger.Error("  CommandView.Initialize", ex);
            }
        }
Exemplo n.º 2
0
Arquivo: Undo.cs Projeto: ausmusel/ibm
        public Undo(ICommandController commandController)
        {
            this.commandController = commandController;

            commandController.CanUndoChanged.Subscribe(_ =>
                                                       this.CanExecuteChanged.Raise(this, EventArgs.Empty));
        }
        /// <summary></summary>
        /// <param name="connectionModeController"></param>
        /// <param name="connectionStateController"></param>
        /// <param name="sendCommandController"></param>
        /// <param name="writeController"></param>
        /// <param name="exchangeViewController"></param>
        public ExchangeGroup(IConnectionModeController connectionModeController, IConnectionStateController connectionStateController, ICommandController sendCommandController,
                             IWriteController writeController, IExchangeViewController exchangeViewController)
        {
            if (connectionModeController == null)
            {
                throw new ArgumentNullException("connectionModeController");
            }
            if (connectionStateController == null)
            {
                throw new ArgumentNullException("connectionStateController");
            }
            if (sendCommandController == null)
            {
                throw new ArgumentNullException("sendCommandController");
            }
            if (writeController == null)
            {
                throw new ArgumentNullException("writeController");
            }
            if (exchangeViewController == null)
            {
                throw new ArgumentNullException("exchangeViewController");
            }

            this._connectionModeController  = connectionModeController;
            this._connectionStateController = connectionStateController;
            this._sendCommandController     = sendCommandController;
            this._writeController           = writeController;
            this._exchangeViewController    = exchangeViewController;
        }
Exemplo n.º 4
0
 public GameController(IGameService gameSevice, IPlayerService playerService, ICommandController commandController)
 {
     this.gameService       = gameSevice;
     this.playerService     = playerService;
     this.commandController = commandController;
     CreateGameHistory();
 }
Exemplo n.º 5
0
        public void Initialize(ILogger logger, ICommandController commandController, ITaskController taskController, TaskResultView taskResultView)
        {
            if (logger == null)
                throw new ArgumentNullException("logger");
            if (commandController == null)
                throw new ArgumentNullException("commandController");
            if (taskController == null)
                throw new ArgumentNullException("taskController");
            if (taskResultView == null)
                throw new ArgumentNullException("taskResultView");

            this.logger = logger;
            this.commandController = commandController;
            this.taskController = taskController;
            this.taskResultView = taskResultView;

            try
            {
                commandItemContainer.ItemsSource = commandController.Commands;
            }
            catch (Exception ex)
            {
                logger.Error("  CommandView.Initialize", ex);
            }
        }
Exemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     Config.SetConfig(config);
     string[] worpedSteps;
     ctrl = group.LunchActionSystem(steps, out worpedSteps);
     LoopExecute(true);
     group.EventTransfer.onUserError += OnUserError;
 }
Exemplo n.º 7
0
        public CommandFactoryManager(ICommandController <TContext> commandController)
        {
            // Establish our code contracts.
            if (commandController == null)
            {
                throw new ArgumentNullException("commandController");
            }

            // Set up the internal collections.
            factories = new Dictionary <HierarchicalPath, ICommandFactory <TContext> >();
        }
Exemplo n.º 8
0
        public MainModel()
        {
            modulesMgr       = new ModulesMgr();
            fileDocumentsMgr = new FileDocumentsMgr(this);
            recentFilesMgr   = new FileDocuments.RecentFilesMgr();

            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;

            // controller handles do/undo history
            // (design pattern: 'Command')
            _controller = new CommandController();
        }
Exemplo n.º 9
0
        public static ICommandController GetCommandController()
        {
            if (instance == null)
            {
                lock (locker)
                {
                    if (instance == null)
                    {
                        instance = new CommandController();
                    }
                }
            }

            return(instance);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 传入command名称关联字典
        /// </summary>
        /// <param name="rule"></param>
        public void LunchActionSystem(Dictionary <string, string[]> rule, UnityAction onLunchOK)
        {
            onCommandRegisted = (activeCommands) =>
            {
                var steps = activeCommands.ConvertAll <string>(x => x.StepName);
                steps.Sort();
                activeCommands   = GetIActionCommandList(activeCommands, steps.ToArray());
                remoteController = new TreeCommandController(rule, activeCommands);
                onLunchOK.Invoke();
            };

            if (commandCtrl.CommandRegisted)
            {
                onCommandRegisted.Invoke(commandCtrl.CommandList);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// 设置安装顺序并生成最终步骤
        /// </summary>
        public void LunchActionSystem <T>(T[] steps, UnityAction <T[]> onLunchOK) where T : IActionStap
        {
            Debug.Assert(steps != null);
            onCommandRegisted = (activeCommands) =>
            {
                var stepsWorp = ConfigSteps <T>(activeCommands, steps);//重新计算步骤
                activeCommands   = GetIActionCommandList(activeCommands, Array.ConvertAll <IActionStap, string>(stepsWorp, x => x.StapName));
                remoteController = new LineCommandController(activeCommands);
                onLunchOK.Invoke(Array.ConvertAll <IActionStap, T>(stepsWorp, x => (T)x));
            };

            if (commandCtrl.CommandRegisted)
            {
                onCommandRegisted.Invoke(commandCtrl.CommandList);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 设置安装顺序并生成最终步骤
        /// </summary>
        public void LunchActionSystem(string[] steps, UnityAction <string[]> onLunchOK)
        {
            Debug.Assert(steps != null);
            onCommandRegisted = (activeCommands) =>
            {
                var stepsWorp = ConfigSteps(activeCommands, steps);//重新计算步骤
                activeCommands   = GetIActionCommandList(activeCommands, stepsWorp);
                remoteController = new LineCommandController(activeCommands);
                onLunchOK.Invoke(stepsWorp);
            };

            if (commandCtrl.CommandRegisted)
            {
                onCommandRegisted.Invoke(commandCtrl.CommandList);
            }
        }
        public async Task <IActionResult> Update([FromBody] Update update)
        {
            using (var scope = _provider.CreateScope())
            {
                var provider = scope.ServiceProvider;
                var commands = _container.GetCommands();

                foreach (ICommand command in commands)
                {
                    ICommandController controller = GetCommandController(command, provider);
                    CommandMatchResult result     = await controller.CheckCommand(update);

                    if (result.Equals(CommandMatchResult.Matching))
                    {
                        break;
                    }
                }
            }
            return(Ok());
        }
Exemplo n.º 14
0
 public MessageProcessor(IConsoleUIComponents consoleUi, ICommandController commandController)
 {
     _consoleUI         = consoleUi;
     _commandController = commandController;
 }
Exemplo n.º 15
0
 public CommandHandler(ICommandController controller)
 {
     this.controller = controller;
 }