ComponentFactory.Krypton.Toolkit.KryptonContextMenuItem.PerformClick C# (CSharp) Method

PerformClick() public method

Generates a Click event for the component.
public PerformClick ( ) : void
return void
        public void PerformClick()
        {
            // Do we toggle the checked state when clicked>
            if (CheckOnClick)
            {
                // Grab current state from command or ourself
                CheckState state = (KryptonCommand == null ? CheckState : KryptonCommand.CheckState);

                // Find new state
                switch (state)
                {
                    case CheckState.Unchecked:
                        state = CheckState.Checked;
                        break;
                    case CheckState.Indeterminate:
                    case CheckState.Checked:
                        state = CheckState.Unchecked;
                        break;
                }

                // Update correct property
                if (KryptonCommand != null)
                    KryptonCommand.CheckState = state;
                else
                    CheckState = state;
            }

            OnClick(EventArgs.Empty);

            // If we have an attached command then execute it
            if (KryptonCommand != null)
                KryptonCommand.PerformExecute();
        }