public void Update (IEditor editor, EditorCommand editorCommand) { this.editor = editor; this.editorCommand = editorCommand; if (editor == null) { editorCommand = default(EditorCommand); status = EditorCommandStatus.Unsupported; } else status = editor.GetCommandStatus (editorCommand); CanExecuteChanged?.Invoke (this, EventArgs.Empty); }
public void Bind(IEditor editor) { currentEditor = editor; if (editor == null || !editor.TryGetCommand(commandId, out command)) { command = default(EditorCommand); status = EditorCommandStatus.Unsupported; } else { Title = command.Title; status = editor.GetCommandStatus(command); } Hidden = status == EditorCommandStatus.Hidden || status == EditorCommandStatus.Unsupported; }