Exemplo n.º 1
0
        private void RevertCurrentCommandState()
        {
            // Is there a current state to revert back?
            if (_currentCmdState != null)
            {
                // Is the command currently open?
                if (_currentCmdState.State == ItemState.Open)
                {
                    // Cast to expected interface
                    ICommandOpen commandOpen = _currentCmdState.Command as ICommandOpen;

                    // Ask the command to close itself now
                    commandOpen.Close();

                    // No longer have logical capture of mouse
                    _mouseCapture = false;
                }

                // Revert it back to normal state
                _currentCmdState.State = ItemState.Normal;

                // Make sure it is repainted
                Invalidate(_currentCmdState.DrawRect);

                // Remove command from being current
                _currentCmdState = null;
            }
        }