示例#1
0
        public IExecutor Execute(string cmd, List <string> args)
        {
            if (cmd == "help")
            {
                Help();
            }
            else if (cmd == "view")
            {
                View();
            }
            else if (cmd == "add")
            {
                Add(args);
            }
            else if (cmd == "remove")
            {
                Remove(args);
            }
            else if (cmd == "name")
            {
                Name(args);
            }
            else if (cmd == "edit")
            {
                Edit(args);
            }
            else if (cmd == "save")
            {
                try
                {
                    _tickSourceBL.SaveTickSource(_tickSource);
                    _console.WriteLine("Сохранено. TickSourceID = " + _tickSource.TickSourceID.ToString());
                    return(_parentExecutor);
                }
                catch (Exception ex)
                {
                    _console.WriteError(ex.ToString());
                }
            }
            else if (cmd == "cancel")
            {
                return(_parentExecutor);
            }
            else
            {
                _console.WriteError("Неизвестная команда");
            }

            return(null);
        }