protected override bool CanDo(out string currentState, out string newState) { currentState = null; newState = null; if (this.Project.ImageGrid == null) { this.CommandsInput.ShowMessage("Please load and process image first"); return(false); } foreach (IPaletteItem item in this.Project.Palette.ToList()) { if (String.IsNullOrWhiteSpace(item.Text)) { if (!this.undoRedoManager.Do(SetPaletteItemTextCommand.CreateWithContext(this.Project, this.CommandsInput, item))) { return(false); } } } if (this.Project.Palette.Select(p => p.Text).Distinct().Count() != this.Project.Palette.Count()) { this.CommandsInput.ShowMessage("Please set a unique name for each selected color by double clicking it"); return(false); } return(this.CommandsInput.SelectTextPatternFile(out newState)); }
public static SetPaletteItemTextCommand CreateWithContext( Corner2CornerProject project, ICorner2CornerCommandsInput commandsInput, IPaletteItem context) { SetPaletteItemTextCommand result = new SetPaletteItemTextCommand(project, commandsInput); result.context = context; return(result); }