/// <summary> /// Creates a new <c>UserAction</c> /// </summary> /// <param name="items">The associated UI elements (at least one of them)</param> /// <param name="isActionEnabled">Delegate that can be used to determine if the action should be enabled (null means the /// action will always be enabled)</param> /// <param name="doAction">Delegate that should be called to perform the action (not null)</param> /// <exception cref="ArgumentNullException">If <paramref name="doAction"/> is null, or the associated /// UI elements are empty or null</exception> public UserAction(ToolStripItem[] items, IsActionEnabled isActionEnabled, DoAction doAction) { if (doAction==null) throw new ArgumentNullException(); m_Elements = new UserActionSupport(items); m_IsActionEnabled = isActionEnabled; m_DoAction = doAction; // Wire the supplied UI elements to a suitable handler m_Elements.SetHandler(Do); }
/// <summary> /// Creates a new <c>UserAction</c> /// </summary> /// <param name="items">The associated UI elements (at least one of them)</param> /// <param name="isActionEnabled">Delegate that can be used to determine if the action should be enabled (null means the /// action will always be enabled)</param> /// <param name="doAction">Delegate that should be called to perform the action (not null)</param> /// <exception cref="ArgumentNullException">If <paramref name="doAction"/> is null, or the associated /// UI elements are empty or null</exception> public UserAction(ToolStripItem[] items, IsActionEnabled isActionEnabled, DoAction doAction) { if (doAction == null) { throw new ArgumentNullException(); } m_Elements = new UserActionSupport(items); m_IsActionEnabled = isActionEnabled; m_DoAction = doAction; // Wire the supplied UI elements to a suitable handler m_Elements.SetHandler(Do); }
/// <summary> /// Copy constructor /// </summary> /// <param name="action">The action to copy</param> protected UserAction(UserAction action) { m_Elements = action.m_Elements; m_IsActionEnabled = action.m_IsActionEnabled; m_DoAction = action.m_DoAction; }
public EditingAction(EditingActionId id, ToolStripItem[] items, IsActionEnabled isActionEnabled, DoAction doAction) : base(items, isActionEnabled, doAction) { m_Id = id; }