public static Command Create(Sugarism.Command model, Mode mode) { if (null == model) { return(null); } if (null == mode) { Log.Error("Not Found Story.Mode"); return(null); } switch (model.CmdType) { case Sugarism.Command.Type.Lines: return(new CmdLines(model as Sugarism.CmdLines, mode)); case Sugarism.Command.Type.Text: return(new CmdText(model as Sugarism.CmdText, mode)); case Sugarism.Command.Type.Appear: return(new CmdAppear(model as Sugarism.CmdAppear, mode)); case Sugarism.Command.Type.Background: return(new CmdBackground(model as Sugarism.CmdBackground, mode)); case Sugarism.Command.Type.MiniPicture: return(new CmdMiniPicture(model as Sugarism.CmdMiniPicture, mode)); case Sugarism.Command.Type.Picture: return(new CmdPicture(model as Sugarism.CmdPicture, mode)); case Sugarism.Command.Type.Filter: return(new CmdFilter(model as Sugarism.CmdFilter, mode)); case Sugarism.Command.Type.SE: return(new CmdSE(model as Sugarism.CmdSE, mode)); case Sugarism.Command.Type.Feeling: return(new CmdFeeling(model as Sugarism.CmdFeeling, mode)); case Sugarism.Command.Type.Switch: return(new CmdSwitch(model as Sugarism.CmdSwitch, mode)); case Sugarism.Command.Type.Case: return(new CmdCase(model as Sugarism.CmdCase, mode)); case Sugarism.Command.Type.TargetAppear: return(new CmdTargetAppear(model as Sugarism.CmdTargetAppear, mode)); case Sugarism.Command.Type.Disappear: return(new CmdDisappear(model as Sugarism.CmdDisappear, mode)); default: return(null); } }
public Command(Sugarism.Command model, Mode mode) { if (null == model) { Log.Error("Not Found Sugarism.Command"); return; } _model = model; _mode = mode; }
/// <summary> /// Create ViewModel from model.Type /// </summary> /// <param name="model"></param> /// <returns>ViewModel corresponding to model.Type. /// If model is null or model.Type is Sugarism.Command.Type.MAX, return null.</returns> public static Command Create(Sugarism.Command model) { if (null == model) { return(null); } switch (model.CmdType) { case Sugarism.Command.Type.Lines: return(new CmdLines(model as Sugarism.CmdLines)); case Sugarism.Command.Type.Text: return(new CmdText(model as Sugarism.CmdText)); case Sugarism.Command.Type.Appear: return(new CmdAppear(model as Sugarism.CmdAppear)); case Sugarism.Command.Type.Background: return(new CmdBackground(model as Sugarism.CmdBackground)); case Sugarism.Command.Type.MiniPicture: return(new CmdMiniPicture(model as Sugarism.CmdMiniPicture)); case Sugarism.Command.Type.Picture: return(new CmdPicture(model as Sugarism.CmdPicture)); case Sugarism.Command.Type.Filter: return(new CmdFilter(model as Sugarism.CmdFilter)); case Sugarism.Command.Type.SE: return(new CmdSE(model as Sugarism.CmdSE)); case Sugarism.Command.Type.Feeling: return(new CmdFeeling(model as Sugarism.CmdFeeling)); case Sugarism.Command.Type.Switch: return(new CmdSwitch(model as Sugarism.CmdSwitch)); case Sugarism.Command.Type.Case: return(new CmdCase(model as Sugarism.CmdCase)); case Sugarism.Command.Type.TargetAppear: return(new CmdTargetAppear(model as Sugarism.CmdTargetAppear)); case Sugarism.Command.Type.Disappear: return(new CmdDisappear(model as Sugarism.CmdDisappear)); default: // Sugarism.Command.Type.MAX return(null); } }
protected Command(Sugarism.Command model) { _model = model; _owner = null; _isExpanded = false; _isSelected = false; _inputBindings = new InputBindingCollection(); // not expand key _inputBindings.Add(new KeyBinding(CmdEdit, Key.E, ModifierKeys.Control)); _inputBindings.Add(new KeyBinding(CmdAddNext, Key.Q, ModifierKeys.Control)); _inputBindings.Add(new KeyBinding(CmdDelete, Key.D, ModifierKeys.Control)); _inputBindings.Add(new KeyBinding(CmdUp, Key.Up, ModifierKeys.Control)); _inputBindings.Add(new KeyBinding(CmdDown, Key.Down, ModifierKeys.Control)); // not addChild key }
private void down(int oldIndex, int newIndex) { Sugarism.Command cmd = _model.CmdList[oldIndex]; _model.CmdList.RemoveAt(oldIndex); insert(newIndex, cmd); }
private void delete(Sugarism.Command cmd) { _model.CmdList.Remove(cmd); }
private void insert(int index, Sugarism.Command cmd) { _model.CmdList.Insert(index, cmd); }