示例#1
0
        public CmdCase(Sugarism.CmdCase model) : base(model)
        {
            _model = model;

            _cmdList = new ObservableCollection <Command>();
            foreach (Sugarism.Command cmdModel in _model.CmdList)
            {
                Command cmdViewModel = Command.Create(cmdModel);
                if (null != cmdViewModel)
                {
                    CmdList.Add(cmdViewModel);
                    cmdViewModel.Owner = this;
                }
                else
                {
                    Log.Error(Properties.Resources.ErrInvalidCmdType);
                }
            }

            _parent = null;

            InputBindings.Clear();
            InputBindings.Add(new KeyBinding(CmdExpand, System.Windows.Input.Key.Enter, ModifierKeys.None));
            InputBindings.Add(new KeyBinding(CmdAddChild, System.Windows.Input.Key.A, ModifierKeys.Control));

            if (_model.CmdList.Count <= 0)
            {
                addSampleCmd();
            }
        }
示例#2
0
        public void AddCmdCase()
        {
            int key = CaseList.Count;

            Sugarism.CmdCase model = new Sugarism.CmdCase(key);

            CmdCase cmdCase = new CmdCase(model);

            int index = key;

            Insert(index, cmdCase);
        }
示例#3
0
        public CmdCase(Sugarism.CmdCase model, Mode mode) : base(model, mode)
        {
            _model = model;

            _cmdList = new List <Command>();
            foreach (Sugarism.Command mCmd in _model.CmdList)
            {
                Command cmd = Command.Create(mCmd, Mode);
                _cmdList.Add(cmd);
            }

            _cmdIter = _cmdList.GetEnumerator();
            _cmdIter.MoveNext();
        }
示例#4
0
 private void delete(Sugarism.CmdCase cmdCase)
 {
     _model.CaseList.Remove(cmdCase);
 }
示例#5
0
 private void insert(int index, Sugarism.CmdCase cmdCase)
 {
     _model.CaseList.Insert(index, cmdCase);
 }