public void Execute(string actionName) { if (string.IsNullOrWhiteSpace(actionName)) { throw new ArgumentNullException("actionName"); } MessageDialog.IsSilent = true; ActionManager.Execute(ActionManager.GetActionId(actionName)); MessageDialog.IsSilent = false; }
public void Bind(ActionId actionId, object control) { ToolStripSplitButton nativeControl = (ToolStripSplitButton)control; nativeControl.ButtonClick += (sender, e) => { ActionManager.Execute(actionId); }; ActionManager.Updating += (s, e) => { nativeControl.Enabled = ActionManager.CanExecute(actionId); }; }
public void Bind(ActionId actionId, object control) { ToolStripMenuItem nativeControl = (ToolStripMenuItem)control; nativeControl.Click += (sender, e) => { ActionManager.Execute(actionId); }; ActionManager.Updating += (s, e) => { IAction action = ActionManager.GetAction(actionId); nativeControl.Enabled = ActionManager.CanExecute(actionId); nativeControl.Checked = action.IsChecked; }; }
public void Bind(ActionId actionId, object control) { RibbonToggleButton nativeControl = (RibbonToggleButton)control; nativeControl.Click += (sender, e) => { ActionManager.Execute(actionId); }; ActionManager.Updating += (s, e) => { IAction action = ActionManager.GetAction(actionId); nativeControl.Enabled = ActionManager.CanExecute(actionId); nativeControl.Checked = nativeControl.Enabled ? action.IsChecked : false; }; }
public void Bind(ActionId actionId, object control) { if (null == control) { throw new ArgumentNullException("control"); } RibbonButton nativeControl = (RibbonButton)control; nativeControl.Click += (sender, e) => { ActionManager.Execute(actionId); }; ActionManager.Updating += (s, e) => { nativeControl.Enabled = ActionManager.CanExecute(actionId); }; }