コード例 #1
0
ファイル: HtmlShim.cs プロジェクト: JianwenSun/cc
 protected HtmlToClrEventProxy AddEventProxy(string eventName, EventHandler eventHandler) {
     if (attachedEventList == null) {
         attachedEventList = new Dictionary<EventHandler, HtmlToClrEventProxy>();
     }     
     HtmlToClrEventProxy proxy = new HtmlToClrEventProxy(this, eventName, eventHandler);
     attachedEventList[eventHandler] = proxy;
     return proxy;
 }
コード例 #2
0
            public override void DetachEventHandler(string eventName, EventHandler eventHandler)
            {
                HtmlToClrEventProxy pdisp = base.RemoveEventProxy(eventHandler);

                if (pdisp != null)
                {
                    ((System.Windows.Forms.UnsafeNativeMethods.IHTMLDocument3) this.NativeHtmlDocument2).DetachEvent(eventName, pdisp);
                }
            }
コード例 #3
0
            /// Support IHTMLWindow3.DetachHandler
            public override void DetachEventHandler(string eventName, System.EventHandler eventHandler)
            {
                HtmlToClrEventProxy proxy = RemoveEventProxy(eventHandler);

                if (proxy != null)
                {
                    ((UnsafeNativeMethods.IHTMLWindow3) this.NativeHtmlWindow).DetachEvent(eventName, proxy);
                }
            }
コード例 #4
0
            public override void DetachEventHandler(string eventName, EventHandler eventHandler)
            {
                HtmlToClrEventProxy proxy = RemoveEventProxy(eventHandler);

                if (proxy != null)
                {
                    ((IHTMLDocument3)NativeHtmlDocument2).DetachEvent(eventName, proxy);
                }
            }
コード例 #5
0
            public override void DetachEventHandler(string eventName, EventHandler eventHandler)
            {
                HtmlToClrEventProxy proxy = RemoveEventProxy(eventHandler);

                if (proxy is not null)
                {
                    ((IHTMLWindow3)NativeHtmlWindow).DetachEvent(eventName, proxy);
                }
            }
コード例 #6
0
            public override void AttachEventHandler(string eventName, EventHandler eventHandler)
            {
                // IE likes to call back on an IDispatch of DISPID=0 when it has an event,
                // the HtmlToClrEventProxy helps us fake out the CLR so that we can call back on
                // our EventHandler properly.

                HtmlToClrEventProxy proxy = AddEventProxy(eventName, eventHandler);

                ((IHTMLDocument3)NativeHtmlDocument2).AttachEvent(eventName, proxy);
            }
コード例 #7
0
 protected HtmlToClrEventProxy RemoveEventProxy(EventHandler eventHandler)
 {
     if ((this.attachedEventList != null) && this.attachedEventList.ContainsKey(eventHandler))
     {
         HtmlToClrEventProxy proxy = this.attachedEventList[eventHandler];
         this.attachedEventList.Remove(eventHandler);
         return(proxy);
     }
     return(null);
 }
コード例 #8
0
ファイル: HtmlShim.cs プロジェクト: xuweijinjin/winforms
        protected HtmlToClrEventProxy AddEventProxy(string eventName, EventHandler eventHandler)
        {
            if (attachedEventList == null)
            {
                attachedEventList = new Dictionary <EventHandler, HtmlToClrEventProxy>();
            }
            HtmlToClrEventProxy proxy = new HtmlToClrEventProxy(this, eventName, eventHandler);

            attachedEventList[eventHandler] = proxy;
            return(proxy);
        }
コード例 #9
0
            /// Support IHtmlDocument3.AttachHandler
            public override void AttachEventHandler(string eventName, System.EventHandler eventHandler)
            {
                // IE likes to call back on an IDispatch of DISPID=0 when it has an event,
                // the HtmlToClrEventProxy helps us fake out the CLR so that we can call back on
                // our EventHandler properly.

                HtmlToClrEventProxy proxy = AddEventProxy(eventName, eventHandler);
                bool success = ((UnsafeNativeMethods.IHTMLWindow3) this.NativeHtmlWindow).AttachEvent(eventName, proxy);

                Debug.Assert(success, "failed to add event");
            }
コード例 #10
0
 public virtual void DisconnectFromEvents()
 {
     if (this.attachedEventList != null)
     {
         EventHandler[] array = new EventHandler[this.attachedEventList.Count];
         this.attachedEventList.Keys.CopyTo(array, 0);
         foreach (EventHandler handler in array)
         {
             HtmlToClrEventProxy proxy = this.attachedEventList[handler];
             this.DetachEventHandler(proxy.EventName, handler);
         }
     }
 }
コード例 #11
0
ファイル: HtmlShim.cs プロジェクト: xuweijinjin/winforms
        /// disconnect from connectionpoint cookie
        /// inheriting classes should override to disconnect from ConnectionPoint and call base.
        public virtual void DisconnectFromEvents()
        {
            if (attachedEventList != null)
            {
                EventHandler[] events = new EventHandler[attachedEventList.Count];
                attachedEventList.Keys.CopyTo(events, 0);

                foreach (EventHandler eh in events)
                {
                    HtmlToClrEventProxy proxy = attachedEventList[eh];
                    DetachEventHandler(proxy.EventName, eh);
                }
            }
        }
コード例 #12
0
ファイル: HtmlShim.cs プロジェクト: xuweijinjin/winforms
        protected HtmlToClrEventProxy RemoveEventProxy(EventHandler eventHandler)
        {
            if (attachedEventList == null)
            {
                return(null);
            }

            if (attachedEventList.ContainsKey(eventHandler))
            {
                HtmlToClrEventProxy proxy = attachedEventList[eventHandler] as HtmlToClrEventProxy;
                attachedEventList.Remove(eventHandler);
                return(proxy);
            }
            return(null);
        }
コード例 #13
0
            public override void AttachEventHandler(string eventName, EventHandler eventHandler)
            {
                HtmlToClrEventProxy pdisp = base.AddEventProxy(eventName, eventHandler);

                ((System.Windows.Forms.UnsafeNativeMethods.IHTMLDocument3) this.NativeHtmlDocument2).AttachEvent(eventName, pdisp);
            }