Ejemplo n.º 1
0
 public virtual void CommandStateChange(int command, bool enable)
 {
     DWebBrowserEvents2_CommandStateChangeEvent commandstatechangeEvent = new DWebBrowserEvents2_CommandStateChangeEvent(command, enable);
     this.parent.RaiseOnCommandStateChange(this.parent, commandstatechangeEvent);
 }
        /// <summary>
        /// Event handler for CommandStateChange -- update our internal command states
        /// then re-fire this event to listeners.
        /// </summary>
        /// <param name="sender">object sending the event</param>
        /// <param name="e">event parameters</param>
        private void AxWebBrowser_CommandStateChange(
            object sender, DWebBrowserEvents2_CommandStateChangeEvent e)
        {
            // constatns representing possible command state changes
            const int CSC_UPDATECOMMANDS = -1;
            const int CSC_NAVIGATEFORWARD = 1;
            const int CSC_NAVIGATEBACK = 2;

            // Back button state changed
            if (e.command == CSC_NAVIGATEBACK)
            {
                m_goBackCommand.SetEnabled(e.enable);
            }
            // Forward button state changed
            else if (e.command == CSC_NAVIGATEFORWARD)
            {
                m_goForwardCommand.SetEnabled(e.enable);
            }
            // General command state change
            else if (e.command == CSC_UPDATECOMMANDS)
            {
                // Do manual update on m_stopCommand
                m_stopCommand.SetEnabled(m_browser.Busy);

                // No update needed for m_refreshCommand or m_goHomeCommand
                // (both are always enabled)
            }

            // fire the CommandStateChanged event so listeners can update their UI
            OnCommandStateChanged(EventArgs.Empty);
        }
Ejemplo n.º 3
0
 internal void RaiseOnCommandStateChange(object sender, DWebBrowserEvents2_CommandStateChangeEvent e)
 {
     if ((this.CommandStateChange != null))
     {
         this.CommandStateChange(sender, e);
     }
 }