コード例 #1
0
        public void AddSampleScene()
        {
            Sugarism.Scene model = new Sugarism.Scene(string.Empty);

            Scene newScene = new Scene(model);

            Insert(0, newScene);
        }
コード例 #2
0
ファイル: Scene.cs プロジェクト: Kelicia91/Sugarism
        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);
        }
コード例 #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();
        }
コード例 #4
0
ファイル: Scene.cs プロジェクト: Kelicia91/Sugarism
        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();
            }
        }
コード例 #5
0
 private void down(int oldIndex, int newIndex)
 {
     Sugarism.Scene scene = _model.SceneList[oldIndex];
     _model.SceneList.RemoveAt(oldIndex);
     insert(newIndex, scene);
 }
コード例 #6
0
 private void delete(Sugarism.Scene scene)
 {
     _model.SceneList.Remove(scene);
 }
コード例 #7
0
 private void insert(int index, Sugarism.Scene scene)
 {
     _model.SceneList.Insert(index, scene);
 }