ComponentFactory.Krypton.Toolkit.MenuLinkLabelController.PressMenuLinkLabel C# (CSharp) Method

PressMenuLinkLabel() private method

private PressMenuLinkLabel ( bool keyboard ) : void
keyboard bool
return void
        private void PressMenuLinkLabel(bool keyboard)
        {
            if (keyboard)
            {
                _target.ElementState =  PaletteState.Pressed;
                _menuLinkLabel.Pressed = true;
                PerformNeedPaint();
                Application.DoEvents();
            }

            // Should we automatically try and close the context menu stack
            if (_menuLinkLabel.KryptonContextMenuLinkLabel.AutoClose)
            {
                // Is the menu capable of being closed?
                if (_menuLinkLabel.CanCloseMenu)
                {
                    // Ask the original context menu definition, if we can close
                    CancelEventArgs cea = new CancelEventArgs();
                    _menuLinkLabel.Closing(cea);

                    if (!cea.Cancel)
                    {
                        // Close the menu from display and pass in the item clicked as the reason
                        _menuLinkLabel.Close(new CloseReasonEventArgs(ToolStripDropDownCloseReason.ItemClicked));
                    }
                }
            }

            if (Click != null)
                Click(this, EventArgs.Empty);

            if (keyboard)
            {
                UpdateTarget();
                PerformNeedPaint();
            }
        }