/// <summary>
        /// Overridden. Invokes accelerator action delegate.
        /// </summary>
        /// <param name="msg">Message send from windows</param>
        /// <param name="keyData">Key params</param>
        /// <returns><strong>True</strong> if successfully processed, otherwise
        /// <strong>false</strong>.</returns>
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            AcceleratorAction action = this.accelerators[keyData] as AcceleratorAction;

            if (action != null)
            {
                action();
                return(true);
            }

            return(base.ProcessCmdKey(ref msg, keyData));
        }
Example #2
0
    ///////////////////////////////////////////////////////////////////////////////
    // Methods for doing main class job                                          //
    ///////////////////////////////////////////////////////////////////////////////
    #region METHODS

    /// <summary>
    /// Sets delegate for given key.
    /// </summary>
    /// <param name="keyCombination">Key to wire action to.</param>
    /// <param name="action">Delegate function.</param>
    protected void SetAccelerator(Keys keyCombination, AcceleratorAction action)
    {
      this.accelerators[keyCombination] = action;
    }
        ///////////////////////////////////////////////////////////////////////////////
        // Methods for doing main class job                                          //
        ///////////////////////////////////////////////////////////////////////////////
        #region METHODS

        /// <summary>
        /// Sets delegate for given key.
        /// </summary>
        /// <param name="keyCombination">Key to wire action to.</param>
        /// <param name="action">Delegate function.</param>
        protected void SetAccelerator(Keys keyCombination, AcceleratorAction action)
        {
            this.accelerators[keyCombination] = action;
        }