Esempio n. 1
0
        public void AddSampleScene()
        {
            Sugarism.Scene model = new Sugarism.Scene(string.Empty);

            Scene newScene = new Scene(model);

            Insert(0, newScene);
        }
Esempio n. 2
0
        public void AddNext()
        {
            if (false == canGetOwner())
            {
                return;
            }

            int nextIndex = Owner.GetIndexOf(this) + 1;

            Sugarism.Scene model = new Sugarism.Scene(string.Empty);

            Scene newScene = new Scene(model);

            Owner.Insert(nextIndex, newScene);
        }
Esempio n. 3
0
        public Scene(Sugarism.Scene model, Mode mode)
        {
            if (null == model)
            {
                Log.Error("Not Found Sugarism.Scene");
                return;
            }

            _model = model;
            _mode  = mode;

            _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();
        }
Esempio n. 4
0
        public Scene(Sugarism.Scene 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);
                }
            }

            _owner = null;

            _isExpanded = false;
            _isSelected = false;

            _inputBindings = new InputBindingCollection();

            _inputBindings.Add(new KeyBinding(CmdExpand, Key.Enter, ModifierKeys.None));
            _inputBindings.Add(new KeyBinding(CmdEdit, Key.E, ModifierKeys.Control));
            _inputBindings.Add(new KeyBinding(CmdAddNext, Key.Q, ModifierKeys.Control));
            // not delete key
            _inputBindings.Add(new KeyBinding(CmdUp, Key.Up, ModifierKeys.Control));
            _inputBindings.Add(new KeyBinding(CmdDown, Key.Down, ModifierKeys.Control));
            _inputBindings.Add(new KeyBinding(CmdAddChild, Key.A, ModifierKeys.Control));

            if (_model.CmdList.Count <= 0)
            {
                addSampleCmd();
            }
        }
Esempio n. 5
0
 private void down(int oldIndex, int newIndex)
 {
     Sugarism.Scene scene = _model.SceneList[oldIndex];
     _model.SceneList.RemoveAt(oldIndex);
     insert(newIndex, scene);
 }
Esempio n. 6
0
 private void delete(Sugarism.Scene scene)
 {
     _model.SceneList.Remove(scene);
 }
Esempio n. 7
0
 private void insert(int index, Sugarism.Scene scene)
 {
     _model.SceneList.Insert(index, scene);
 }