Example #1
0
        public void ExcuteCommand(INotification notification)
        {
            string   name    = notification.Name;
            ICommand command = commandMap[name]();

            command.Excute(notification);
        }
Example #2
0
        public string ExcuteCommad(string strCommand)
        {
            ICommand command     = null;
            var      listCommand = strCommand.Split(' ').Where(e => !string.IsNullOrEmpty(e)).ToList();

            if (listCommand.Count == 0)
            {
                return(string.Empty);
            }
            command = Commands.Where(p => p.Key.ToUpper() == listCommand[0].ToUpper()).FirstOrDefault();
            if (command != null)
            {
                listCommand.RemoveAt(0);
                try
                {
                    return(command.Excute(listCommand.ToArray()));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    return(ex.Message);
                }
            }
            else
            {
                string msg = string.Format("'{0}' 不是可识别的命令", listCommand[0]);
                Console.WriteLine(msg);
                return(msg);
            }
        }
Example #3
0
        public static string ExcuteCommad(string strCommand)
        {
            ICommand command     = null;
            var      listCommand = strCommand.Split(' ').Where(e => !string.IsNullOrEmpty(e)).ToList();

            if (listCommand.Count == 0)
            {
                return(string.Empty);
            }
            if (CommandDict.TryGetValue(listCommand[0], out command))
            {
                listCommand.RemoveAt(0);
                try
                {
                    return(command.Excute(listCommand.ToArray()));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    return(ex.Message);
                }
            }
            else
            {
                string msg = string.Format("'{0}' 不是可识别的命令", listCommand[0]);
                Console.WriteLine(msg);
                return(msg);
            }
        }
Example #4
0
 public void Excute(AsyncParameters parameters, string cmd)
 {
     try
     {
         ICommand icmd = CommandFactory.Creat(cmd);
         icmd.Excute();
     }
     catch { }
 }
Example #5
0
 public void Excute(AsyncParameters parameters, string cmd)
 {
     foreach (Item i in Items)
     {
         if (i.Cmd == cmd)
         {
             try
             {
                 ICommand icmd = CommandFactory.Creat(i.ToCmd());
                 icmd.Excute();
             }
             catch { }
         }
     }
 }
Example #6
0
        public void ExcuteCommand(ICommand command, params object[] args)
        {
            if(!command.Excute(args)) return;
            reverseStack.Clear();

            if (command is IBackableCommand)
            {
                undoStack.Push((ICommand)command.Clone());
            }
            else
            {
                undoStack.Clear();
            }

            UndoStateChanged(undoStack.Count > 0);
        }
        public void Update()
        {
            lock (lock_)
            {
                if (clear_)
                {
                    if (list_.Count > 0)
                    {
                        list_.Clear();
                    }

                    clear_ = false;
                }

                lock (pending_lock_)
                {
                    // Adds from pending list
                    if (pending_.Count > 0)
                    {
                        list_.AddRange(pending_);
                        pending_.Clear();
                    }
                }

                // Excutes commands
                while (list_.Count > 0)
                {
                    ICommand cmd = list_[0];

                    if (cmd.canExcute)
                    {
                        cmd.canExcute = false;
                        cmd.Excute();
                    }

                    if (cmd.keepWaiting)
                    {
                        break;
                    }

                    list_.RemoveAt(0);
                }
            }
        }
Example #8
0
        public void ExcuteCommand(ICommand command, params object[] args)
        {
            if (!command.Excute(args))
            {
                return;
            }
            reverseStack.Clear();

            if (command is IBackableCommand)
            {
                undoStack.Push((ICommand)command.Clone());
            }
            else
            {
                undoStack.Clear();
            }

            UndoStateChanged(undoStack.Count > 0);
        }
Example #9
0
    void Update()
    {
        if (Input.GetKey(KeyCode.A) || _joystick.Horizontal == -1)
        {
            _cameraLeft = new CameraMoveLeft(_cameraSpeed);
            _cameraLeft.Excute();
        }
        else if (Input.GetKey(KeyCode.D) || _joystick.Horizontal == 1)
        {
            _cameraRight = new CameraMoveRight(_cameraSpeed);
            _cameraRight.Excute();
        }
        else if (Input.GetKey(KeyCode.W) || _joystick.Vertical == 1)
        {
            _cameraUp = new CameraMoveUp(_cameraSpeed);
            _cameraUp.Excute();
        }
        else if (Input.GetKey(KeyCode.S) || _joystick.Vertical == -1)
        {
            _cameraDown = new CameraMoveDown(_cameraSpeed);
            _cameraDown.Excute();
        }
        else if (Input.GetKeyDown(KeyCode.R))
        {
            //YZ평면을 기준으로 방향벡터 대칭이동
            Vector3 newForward = _camera.transform.forward;
            newForward.x *= -1;
            _camera.transform.forward = newForward;

            Plane plane = new Plane(Vector3.up, 0);

            float distance;
            Ray   ray = new Ray(_camera.transform.position, _camera.transform.forward);
            if (plane.Raycast(ray, out distance))
            {
                Vector3 newPos = ray.GetPoint(distance);
                _camera.transform.position -= newPos;
            }
        }

        _inputMode.Update();
    }
 public void ButtonWasPressed()
 {
     slot.Excute();
 }
Example #11
0
 public void Excute()
 {
     command.Excute();
 }
 public void ExcuteCommand()
 {
     _cmd.Excute();
 }
 public void ReciveCommand(ICommand command)
 {
     command.Excute(Holder);
 }
Example #14
0
 public void ShowAndSave()
 {
     Console.WriteLine("Invoker trying to show and save content");
     showCommand.Excute();
     saveCommand.Excute();
 }
Example #15
0
 public void Do(ICommand aCommand)
 {
     aCommand.Excute();
     commandList.Add(aCommand);
     current++;
 }