/// <summary> /// Called when the trackbar value changes. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">A <see cref="EventArgs"/> that contains no data.</param> void toolStripTrackBarItem_ValueChanged(object sender, EventArgs e) { NuGenToolStripTrackBar item = sender as NuGenToolStripTrackBar; NuGenApplicationCommand applicationCommand = CommandManager.GetApplicationCommandByItem(item); if (applicationCommand != null) { Control ownerControl = GetOwnerControl(sender); applicationCommand.Execute(ownerControl, item); } }
/// <summary> /// Called when an item is removed from the <see cref="NuGenUIItemCollection"/> collection. /// </summary> /// <param name="item">The item that has been removed.</param> public override void UIItemRemoved(object item) { NuGenToolStripTrackBar toolStripTrackBarItem = item as NuGenToolStripTrackBar; if (toolStripTrackBarItem != null) { toolStripTrackBarItem.EnabledChanged -= new EventHandler(toolStripItem_EnabledChanged); toolStripTrackBarItem.VisibleChanged -= new EventHandler(toolStripItem_VisibleChanged); toolStripTrackBarItem.ValueChanged -= new EventHandler(toolStripTrackBarItem_ValueChanged); } else { base.UIItemRemoved(item); } }
/// <summary> /// Called when an item is added to the <see cref="NuGenUIItemCollection"/> collection. /// </summary> /// <remarks> /// The adapter should normally add an event handler to the Click event of this item. /// </remarks> /// <param name="command">The command that has an item added.</param> /// <param name="item">The item that has been added.</param> public override void UIItemAdded(NuGenApplicationCommand command, object item) { NuGenToolStripTrackBar toolStripTrackBarItem = item as NuGenToolStripTrackBar; if (toolStripTrackBarItem != null) { toolStripTrackBarItem.EnabledChanged += new EventHandler(toolStripItem_EnabledChanged); toolStripTrackBarItem.VisibleChanged += new EventHandler(toolStripItem_VisibleChanged); toolStripTrackBarItem.ValueChanged += new EventHandler(toolStripTrackBarItem_ValueChanged); } else { base.UIItemAdded(command, item); } }