Пример #1
0
        /// <summary>
        /// Called when an item is clicked.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A <see cref="EventArgs"/> that contains no data.</param>
        void menuItem_Click(object sender, EventArgs e)
        {
            MenuItem item = sender as MenuItem;
            NuGenApplicationCommand applicationCommand = _commandManager.GetApplicationCommandByItem(item);

            if (applicationCommand != null)
            {
                Control ownerControl = GetOwnerControl(sender);
                _owner = null;
                applicationCommand.Execute(ownerControl, item);
            }
        }
Пример #2
0
 /// <summary>
 /// Called when an item's enabled state has changed.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">An <see cref="EventArgs"/> that contains no event data.</param>
 void toolStripItem_EnabledChanged(object sender, EventArgs e)
 {
     if (inEnabledChanged)
     {
         return;
     }
     try
     {
         inEnabledChanged = true;
         NuGenApplicationCommand applicationCommand = _commandManager.GetApplicationCommandByItem(sender);
         if (applicationCommand != null)
         {
             ToolStripItem item = sender as ToolStripItem;
             applicationCommand.Enabled = item.Enabled;
         }
     }
     finally
     {
         inEnabledChanged = false;
     }
 }