ComponentFactory.Krypton.Toolkit.MenuRadioButtonController.PressMenuRadioButton C# (CSharp) Method

PressMenuRadioButton() private method

private PressMenuRadioButton ( bool keyboard ) : void
keyboard bool
return void
        private void PressMenuRadioButton(bool keyboard)
        {
            if (keyboard)
            {
                _menuRadioButton.ViewDrawContent.ElementState = PaletteState.Pressed;
                PerformNeedPaint();
                Application.DoEvents();
            }

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

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

            // Do we need to automatically change the checked state?
            if (_menuRadioButton.KryptonContextMenuRadioButton.AutoCheck)
            {
                // We only alter state if it is currently not checked
                if (!_menuRadioButton.KryptonContextMenuRadioButton.Checked)
                    _menuRadioButton.KryptonContextMenuRadioButton.Checked = true;
            }

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

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