示例#1
0
 public void AddHandler(WebBrowserEvent evt, Delegate handler)
 {
     lock (this._Handlers)
     {
         Delegate delegate2;
         this._Handlers.TryGetValue(evt, out delegate2);
         this._Handlers[evt] = Delegate.Combine(delegate2, handler);
     }
 }
示例#2
0
        private Delegate GetHandler(WebBrowserEvent evt)
        {
            Delegate delegate2;

            lock (this._Handlers)
            {
                this._Handlers.TryGetValue(evt, out delegate2);
            }
            return(delegate2);
        }
        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));
            }
        }
示例#4
0
 private void Attach()
 {
     var axIWebBrowser2 = _webBrowser.ReflectGetProperty("AxIWebBrowser2");
     var webBrowserEvent = new WebBrowserEvent(this);
     var cookieType = typeof(System.Windows.Controls.WebBrowser).Assembly.GetType("MS.Internal.Controls.ConnectionPointCookie");
     _cookie = Activator.CreateInstance(
         cookieType,
         ReflectionService.BindingFlags,
         null,
         new[] { axIWebBrowser2, webBrowserEvent, typeof(DWebBrowserEvents2) },
         CultureInfo.CurrentUICulture);
 }
        private void Attach()
        {
            var axIWebBrowser2  = _webBrowser.ReflectGetProperty("AxIWebBrowser2");
            var webBrowserEvent = new WebBrowserEvent(this);
            var cookieType      = typeof(WebBrowser).Assembly.GetType("MS.Internal.Controls.ConnectionPointCookie");

            _cookie = Activator.CreateInstance(
                cookieType,
                ReflectionService.BindingFlags,
                null,
                new[] { axIWebBrowser2, webBrowserEvent, typeof(DWebBrowserEvents2) },
                CultureInfo.CurrentUICulture);
        }
示例#6
0
 public void RemoveHandler(WebBrowserEvent evt, Delegate handler)
 {
     lock (this._Handlers)
     {
         Delegate delegate2;
         if (this._Handlers.TryGetValue(evt, out delegate2))
         {
             delegate2 = Delegate.Remove(delegate2, handler);
             if (delegate2 != null)
             {
                 this._Handlers[evt] = delegate2;
             }
             else
             {
                 this._Handlers.Remove(evt);
             }
         }
     }
 }
 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));
     }
 }
示例#8
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));
     }
 }
示例#9
0
 private void TestCommonAttributes(WebBrowserEvent deserialized)
 {
     Assert.AreEqual(commonUrl, deserialized.CurrentURL);
     Assert.AreEqual(commonDateTime, deserialized.Timestamp);
     Assert.AreEqual(commonTabId, deserialized.TabID);
 }
 public void Handle(WebBrowserEvent message)
 {
     currentUrl = message.CurrentUrl;
 }