public PluginUIElementCommand(IPluginUIElement uiElement) { _uiElement = uiElement; Text = _uiElement.Text; ImageLarge = _uiElement.Image; ImageSmall = _uiElement.Image; _uiElement.CommandExecuted += CommandExecuted; _uiElement.UIChanged += UIChanged; }
private KryptonCommand CreateCommandForPluginUIElement(IPluginUIElement uiElement) { KryptonCommand command; if (uiElement is IPluginCheckedUIElement) { command = new CheckedPluginUIElementCommand((IPluginCheckedUIElement)uiElement); } else { command = new PluginUIElementCommand(uiElement); } _uiElementsCommands.Add(uiElement.Id, command); return(command); }
protected virtual void UIChanged(IPluginUIElement obj) { Enabled = _uiElement.Enabled; UpdateImage(); }
protected virtual void CommandExecuted(object sender, IPluginUIElement pluginUIElement) { }
void OnCheckedChanged(IPluginUIElement obj) { Checked = _uiElement.Checked; }
/// <summary> /// Raises CommandExecuted event /// </summary> /// <param name="sender">UI object assigned with this action</param> /// <param name="pluginUIElement">UI element</param> protected void RaiseCommandExecutedEvent(object sender, IPluginUIElement pluginUIElement) { CommandExecuted?.Invoke(sender, pluginUIElement); }