public bool TryUpdate(Color color, string newText, out IPaletteItem original) { PaletteItem current; if (this.palette.TryGetValue(color, out current)) { original = new PaletteItem(current); current.Text = newText; return(true); } original = null; return(false); }
protected override bool CanDo(out IPaletteItem currentState, out IPaletteItem newState) { currentState = null; newState = null; if (context == null && !this.CommandsInput.GetCurrentPaletteItem(out context)) { return(false); } if (this.CommandsInput.GetPaletteItemText(context, out string newText)) { if (this.Project.Palette.Find(context.Color, out currentState)) { currentState = new PaletteItem(currentState); newState = new PaletteItem(color: context.Color, text: newText); return(true); } } return(false); }