protected override void CreateSink()
 {
     //MAKE SURE TO CALL THE BASE or the normal events won't fire
       base.CreateSink();
       events = new WebBrowserExtendedEvents(this);
       cookie = new AxHost.ConnectionPointCookie(this.ActiveXInstance, events, typeof(DWebBrowserEvents2));
 }
        protected override void CreateSink()
        {
            base.CreateSink();

            _helper = new ExtendedWebBrowserEventHelper(this);
            _cookie = new AxHost.ConnectionPointCookie(ActiveXInstance, _helper, typeof(DWebBrowserEvents2));
        }
 public override void DisconnectFromEvents()
 {
     if (_cookie != null)
     {
         _cookie.Disconnect();
         _cookie = null;
     }
 }
 protected override void DetachSink()
 {
     if (this.cookie != null)
     {
         this.cookie.Disconnect();
         this.cookie = null;
     }
 }
Exemplo n.º 5
0
        protected override void CreateSink()
        {
            base.CreateSink();

            helper = new DWebBrowserEvent2Helper(this);
            cookie = new AxHost.ConnectionPointCookie(
                this.ActiveXInstance, helper, typeof(DWebBrowserEvents2));
        }
 public override void DisconnectFromEvents()
 {
     if (this.cookie != null)
     {
         this.cookie.Disconnect();
         this.cookie = null;
     }
 }
 internal void StopEvents()
 {
     if (this.connectionPoint != null)
     {
         this.connectionPoint.Disconnect();
         this.connectionPoint = null;
     }
 }
 protected override void DetachSink()
 {
     if (cookie != null) {
         cookie.Disconnect();
         cookie = null;
     }
     base.DetachSink();
 }
Exemplo n.º 9
0
 internal void StopEvents()
 {
     if (connectionPoint != null)
     {
         connectionPoint.Disconnect();
         connectionPoint = null;
     }
 }
Exemplo n.º 10
0
		protected override void DetachSink() {
			// Disconnect the client that handles the event
			// from the underlying ActiveX control.
			if (cookie != null) {
				cookie.Disconnect();
				cookie = null;
			}
			base.DetachSink();
		}
Exemplo n.º 11
0
		protected override void CreateSink() {
			base.CreateSink();

			// Create an instance of the client that will handle the event
			// and associate it with the underlying ActiveX control.
			helper = new EventHelper(this);
			cookie = new AxHost.ConnectionPointCookie(
				ActiveXInstance, helper, typeof(DWebBrowserEvents2));
		}
Exemplo n.º 12
0
 protected override void CreateSink()
 {
     try
     {
         this.eventMulticaster = new AxUnityWebPlayerEventMulticaster(this);
         this.cookie = new AxHost.ConnectionPointCookie(this.ocx, this.eventMulticaster, typeof(_DUnityWebPlayerAXEvents));
     }
     catch (Exception)
     {
     }
 }
        protected override void CreateSink()
        {
            object activeXInstance = base.activeXInstance;

            if (activeXInstance != null)
            {
                this.webBrowserEvent = new WebBrowserEvent(this);
                this.webBrowserEvent.AllowNavigation = this.AllowNavigation;
                this.cookie = new AxHost.ConnectionPointCookie(activeXInstance, this.webBrowserEvent, typeof(System.Windows.Forms.UnsafeNativeMethods.DWebBrowserEvents2));
            }
        }
 public override void ConnectToEvents()
 {
     if ((this.cookie == null) || !this.cookie.Connected)
     {
         this.cookie = new AxHost.ConnectionPointCookie(this.NativeHtmlDocument2, new HtmlDocument.HTMLDocumentEvents2(this.htmlDocument), typeof(System.Windows.Forms.UnsafeNativeMethods.DHTMLDocumentEvents2), false);
         if (!this.cookie.Connected)
         {
             this.cookie = null;
         }
     }
 }
Exemplo n.º 15
0
 public override void ConnectToEvents()
 {
     if ((this.cookie == null) || !this.cookie.Connected)
     {
         for (int i = 0; (i < dispInterfaceTypes.Length) && (this.cookie == null); i++)
         {
             this.cookie = new AxHost.ConnectionPointCookie(this.NativeHtmlElement, new HtmlElement.HTMLElementEvents2(this.htmlElement), dispInterfaceTypes[i], false);
             if (!this.cookie.Connected)
             {
                 this.cookie = null;
             }
         }
     }
 }
 /// Support HTMLWindowEvents2
 public override void ConnectToEvents()
 {
     if (cookie == null || !cookie.Connected)
     {
         this.cookie = new AxHost.ConnectionPointCookie(NativeHtmlWindow,
                                                        new HTMLWindowEvents2(htmlWindow),
                                                        typeof(UnsafeNativeMethods.DHTMLWindowEvents2),
                                                        /*throwException*/ false);
         if (!cookie.Connected)
         {
             cookie = null;
         }
     }
 }
 public override void ConnectToEvents()
 {
     if (_cookie is null || !_cookie.Connected)
     {
         _cookie = new AxHost.ConnectionPointCookie(NativeHtmlDocument2,
                                                    new HTMLDocumentEvents2(_htmlDocument),
                                                    typeof(DHTMLDocumentEvents2),
                                                    /*throwException*/ false);
         if (!_cookie.Connected)
         {
             _cookie = null;
         }
     }
 }
Exemplo n.º 18
0
        internal void Initialize()
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            IVsTextManager2 textManager = (IVsTextManager2)this.serviceProvider.GetService(typeof(SVsTextManager));
            VIEWPREFERENCES2[] viewPreferences = new VIEWPREFERENCES2[] { new VIEWPREFERENCES2() };
            LANGPREFERENCES2[] languagePreferences = new LANGPREFERENCES2[] { new LANGPREFERENCES2() { guidLang = Guids.Service } };

            int hresult = textManager.GetUserPreferences2(viewPreferences, pFramePrefs: null, pLangPrefs: languagePreferences, pColorPrefs: null);
            ErrorHandler.ThrowOnFailure(hresult);

            this.UpdatePreferences(viewPreferences, languagePreferences);

            this.connectionPoint = new AxHost.ConnectionPointCookie(textManager, this, typeof(IVsTextManagerEvents2));
        }
Exemplo n.º 19
0
 public override void ConnectToEvents()
 {
     if (_cookie is null || !_cookie.Connected)
     {
         for (int i = 0; i < s_dispInterfaceTypes.Length && _cookie is null; i++)
         {
             _cookie = new AxHost.ConnectionPointCookie(NativeHtmlElement,
                                                        new HTMLElementEvents2(_htmlElement),
                                                        s_dispInterfaceTypes[i],
                                                        /*throwException*/ false);
             if (!_cookie.Connected)
             {
                 _cookie = null;
             }
         }
     }
 }
 internal void StartEvents()
 {
     if (this.connectionPoint == null)
     {
         object activeXInstance = this.Host.activeXInstance;
         if (activeXInstance != null)
         {
             try
             {
                 this.connectionPoint = new AxHost.ConnectionPointCookie(activeXInstance, this, typeof(UnsafeNativeMethods.IPropertyNotifySink));
             }
             catch (Exception exception)
             {
                 if (System.Windows.Forms.ClientUtils.IsCriticalException(exception))
                 {
                     throw;
                 }
             }
         }
     }
 }
Exemplo n.º 21
0
        internal void StartEvents()
        {
            if (connectionPoint != null)
            {
                return;
            }

            object nativeObject = Host.activeXInstance;

            if (nativeObject != null)
            {
                try
                {
                    connectionPoint = new AxHost.ConnectionPointCookie(nativeObject, this, typeof(Ole32.IPropertyNotifySink));
                }
                catch (Exception ex)
                {
                    if (ClientUtils.IsCriticalException(ex))
                    {
                        throw;
                    }
                }
            }
        }
 protected override void CreateSink()
 {
     base.CreateSink();
     events = new WebBrowserExtendedEvents(this);
     cookie = new AxHost.ConnectionPointCookie(this.ActiveXInstance, events, typeof(DWebBrowserEvents2));
 }
 internal void StartEvents()
 {
     if (this.connectionPoint == null)
     {
         object activeXInstance = this.Host.activeXInstance;
         if (activeXInstance != null)
         {
             try
             {
                 this.connectionPoint = new AxHost.ConnectionPointCookie(activeXInstance, this, typeof(UnsafeNativeMethods.IPropertyNotifySink));
             }
             catch (Exception exception)
             {
                 if (System.Windows.Forms.ClientUtils.IsCriticalException(exception))
                 {
                     throw;
                 }
             }
         }
     }
 }
Exemplo n.º 24
0
        protected override void DetachSink()
        {
            if (_cookie == null)
            return;

              _cookie.Disconnect();
              _cookie = null;
        }
Exemplo n.º 25
0
 /// <include file='doc\WebBrowser.uex' path='docs/doc[@for="WebBrowser.DetachSink"]/*' />
 /// <devdoc>
 ///     <para>
 /// Releases the DWebBrowserEvents2 connection point.
 ///     </para>
 /// </devdoc>
 protected override void DetachSink() {
     //If we have a cookie get rid of it
     if (this.cookie != null) {
         this.cookie.Disconnect();
         this.cookie = null;
     }
 }
Exemplo n.º 26
0
 /// <include file='doc\WebBrowser.uex' path='docs/doc[@for="WebBrowser.CreateSink"]/*' />
 /// <devdoc>
 ///     <para>
 /// Attaches to the DWebBrowserEvents2 connection point.
 ///     </para>
 /// </devdoc>
 protected override void CreateSink() {
     object ax = this.activeXInstance;
     if (ax != null) {
         webBrowserEvent = new WebBrowserEvent(this);
         webBrowserEvent.AllowNavigation = AllowNavigation;
         this.cookie = new AxHost.ConnectionPointCookie(ax, webBrowserEvent,
                 typeof(UnsafeNativeMethods.DWebBrowserEvents2));
     }
 }
 protected override void CreateSink()
 {
     object activeXInstance = base.activeXInstance;
     if (activeXInstance != null)
     {
         this.webBrowserEvent = new WebBrowserEvent(this);
         this.webBrowserEvent.AllowNavigation = this.AllowNavigation;
         this.cookie = new AxHost.ConnectionPointCookie(activeXInstance, this.webBrowserEvent, typeof(System.Windows.Forms.UnsafeNativeMethods.DWebBrowserEvents2));
     }
 }
 internal void StopEvents()
 {
     if (this.connectionPoint != null)
     {
         this.connectionPoint.Disconnect();
         this.connectionPoint = null;
     }
 }
 public override void ConnectToEvents()
 {
     if ((this.cookie == null) || !this.cookie.Connected)
     {
         for (int i = 0; (i < dispInterfaceTypes.Length) && (this.cookie == null); i++)
         {
             this.cookie = new AxHost.ConnectionPointCookie(this.NativeHtmlElement, new HtmlElement.HTMLElementEvents2(this.htmlElement), dispInterfaceTypes[i], false);
             if (!this.cookie.Connected)
             {
                 this.cookie = null;
             }
         }
     }
 }
Exemplo n.º 30
0
 public override void ConnectToEvents()
 {
     if (cookie == null || !cookie.Connected)
     {
         for (int i = 0; i < dispInterfaceTypes.Length && this.cookie == null; i++)
         {
             this.cookie = new AxHost.ConnectionPointCookie(this.NativeHtmlElement,
                                                                       new HTMLElementEvents2(htmlElement),
                                                                       dispInterfaceTypes[i],
                                                                       /*throwException*/ false);
             if (!cookie.Connected) 
             {
                 cookie = null;
             }
         }
     }
 }
Exemplo n.º 31
0
 protected override void DetachSink()
 {
     if (null != cookie)
     {
         cookie.Disconnect();
         cookie = null;
     }
 }
Exemplo n.º 32
0
 protected override void CreateSink()
 {
     // Make sure to call the base class or the normal events won't fire
     base.CreateSink();
     events = new WebBrowserExtendedEvents(this);
     cookie = new AxHost.ConnectionPointCookie(this.ActiveXInstance, events, typeof(UnsafeNativeMethods.DWebBrowserEvents2));
 }
Exemplo n.º 33
0
        /// <devdoc>
        ///  Sinks the property notify events on all the objects we are currently
        ///  browsing.
        ///
        ///  See IPropertyNotifySink
        /// </devdoc>
        private void SinkPropertyNotifyEvents() {
            // first clear any existing sinks.
            for (int i = 0;connectionPointCookies != null && i < connectionPointCookies.Length; i++) {
                if (connectionPointCookies[i] != null) {
                    connectionPointCookies[i].Disconnect();
                    connectionPointCookies[i] = null;
                }
            }

            if (currentObjects == null || currentObjects.Length == 0) {
                connectionPointCookies = null;
                return;
            }

            // it's okay if our array is too big...we'll just reuse it and ignore the empty slots.
            if (connectionPointCookies == null || (currentObjects.Length > connectionPointCookies.Length)) {
                connectionPointCookies = new AxHost.ConnectionPointCookie[currentObjects.Length];
            }
            
            for (int i = 0; i < currentObjects.Length; i++) {
                try {
                    Object obj = GetUnwrappedObject(i);

                    if (!Marshal.IsComObject(obj)) {
                        continue;
                    }
                    connectionPointCookies[i] = new AxHost.ConnectionPointCookie(obj, this, typeof(UnsafeNativeMethods.IPropertyNotifySink), /*throwException*/ false);
                }
                catch {
                    // guess we failed eh?
                }
            }
        }
Exemplo n.º 34
0
 protected override void CreateSink()
 {
     base.CreateSink();
     this.events = new WebBrowserExtendedEvents(this);
     this.cookie = new AxHost.ConnectionPointCookie(base.ActiveXInstance, this.events, typeof(WinFormsUI.Controls.UnsafeNativeMethods.DWebBrowserEvents2));
 }
Exemplo n.º 35
0
 protected override void CreateSink()
 {
     try { this.cookie = new ConnectionPointCookie(this.GetOcx(), this, typeof(IWebBrowserEvents)); }
     catch { }
 }
 public override void DisconnectFromEvents()
 {
     if (this.cookie != null)
     {
         this.cookie.Disconnect();
         this.cookie = null;
     }
 }
Exemplo n.º 37
0
 protected override void DetachSink()
 {
     if (this.cookie != null)
     {
         this.cookie.Disconnect();
     }
     this.cookie = null;
     this.events = null;
     base.DetachSink();
 }
 internal void StartEvents()
 {
     if (this.connectionPoint == null)
     {
         object ocx = this.host.GetOcx();
         try
         {
             this.connectionPoint = new AxHost.ConnectionPointCookie(ocx, this, typeof(System.Windows.Forms.UnsafeNativeMethods.IPropertyNotifySink));
         }
         catch
         {
         }
     }
 }
Exemplo n.º 39
0
 /// Support HTMLWindowEvents2
 public override void ConnectToEvents()
 {
     if (cookie == null || !cookie.Connected)
     {
         this.cookie = new AxHost.ConnectionPointCookie(NativeHtmlWindow,
                                                                   new HTMLWindowEvents2(htmlWindow),
                                                                   typeof(UnsafeNativeMethods.DHTMLWindowEvents2),
                                                                   /*throwException*/ false);
         if (!cookie.Connected) 
         {
             cookie = null;
         }
     }
 }
Exemplo n.º 40
0
        protected override void CreateSink()
        {
            // Make sure to call the base class or the normal events won't fire
              base.CreateSink();
              if (BrowserEvents == null)
            return;

              _cookie = new AxHost.ConnectionPointCookie (ActiveXInstance, BrowserEvents, typeof (DWebBrowserEvents2));
        }
Exemplo n.º 41
0
 protected override void CreateSink() 
 {
     try 
     {
         this.eventMulticaster = new WebBrowserEventMulticaster(this);
         this.cookie = new AxHost.ConnectionPointCookie(this.ocx, this.eventMulticaster, typeof(DWebBrowserEvents2));
     }
     catch (System.Exception ) 
     {
     }
 }
 protected override void DetachSink()
 {
     if (this.cookie != null)
     {
         this.cookie.Disconnect();
         this.cookie = null;
     }
 }
 public override void ConnectToEvents()
 {
     if ((this.cookie == null) || !this.cookie.Connected)
     {
         this.cookie = new AxHost.ConnectionPointCookie(this.NativeHtmlWindow, new HtmlWindow.HTMLWindowEvents2(this.htmlWindow), typeof(System.Windows.Forms.UnsafeNativeMethods.DHTMLWindowEvents2), false);
         if (!this.cookie.Connected)
         {
             this.cookie = null;
         }
     }
 }