예제 #1
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));
 }
예제 #2
0
 //This method will be called to give you a chance to create your own event sink
 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(ActiveXInstance, events, typeof(DWebBrowserEvents2));
 }
예제 #3
0
 protected override void CreateSink()
 {
     base.CreateSink();
     helper = new DWebBrowserEvent2Helper(this);
     cookie = new AxHost.ConnectionPointCookie(
         this.ActiveXInstance, helper, typeof(DWebBrowserEvents2));
 }
예제 #4
0
        protected override void CreateSink()
        {
            base.CreateSink();

            _helper = new ExtendedWebBrowserEventHelper(this);
            _cookie = new AxHost.ConnectionPointCookie(ActiveXInstance, _helper, typeof(DWebBrowserEvents2));
        }
예제 #5
0
파일: WebBrowser2.cs 프로젝트: qwdingyu/C-
 protected override void CreateSink()
 {
     //  一定在此调用基类的方法,否则WebBrowser自己实现的事件就不能触发了
     base.CreateSink();
     webBrowserEvent2 = new WebBrowserEvent2(this);
     cookie           = new AxHost.ConnectionPointCookie(this.ActiveXInstance, webBrowserEvent2, typeof(IWebBrowserEvent2));
 }
예제 #6
0
 public void Dispose()
 {
     if (_cookie != null)
     {
         _cookie.Disconnect();
         _cookie = null;
     }
 }
예제 #7
0
 protected override void DetachSink()
 {
     if (this.cookie != null)
     {
         this.cookie.Disconnect();
         this.cookie = null;
     }
 }
예제 #8
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 ExtendedWinFormsWebBrowserEventHelper(this);
     cookie = new AxHost.ConnectionPointCookie(ActiveXInstance, helper, typeof(DWebBrowserEvents2));
 }
예제 #9
0
 protected override void DetachSink()
 {
     if (null != cookie)
     {
         cookie.Disconnect();
         cookie = null;
     }
 }
예제 #10
0
 protected internal virtual void StopEvents()
 {
     if (this.connectionPoint != null)
     {
         this.connectionPoint.Disconnect();
         this.connectionPoint = null;
     }
 }
예제 #11
0
 protected override void DetachSink()
 {
     if (cookie != null)
     {
         cookie.Disconnect(); cookie = null;
     }
     base.DetachSink();
 }
예제 #12
0
        protected override void CreateSink()
        {
            // Make sure to call the base class or the normal events won't fire
            base.CreateSink();

            // Create an instance of the client that will handle the event
            // and associate it with the underlying ActiveX control.
            events = new WebBrowserExtendedEvents(this);
            cookie = new AxHost.ConnectionPointCookie(this.ActiveXInstance, events, typeof(UnsafeNativeMethods.DWebBrowserEvents2));
        }
        public void ConnectionPointCookie_Ctor_Object_Object_Type()
        {
            Type   type      = Type.GetTypeFromCLSID(CLSID_WebBrowser);
            object source    = Activator.CreateInstance(type);
            var    sink      = new CustomPropertyNotifySink();
            Type   eventType = typeof(Ole32.IPropertyNotifySink);

            // Just verify that creation succeeded.
            var cookie = new AxHost.ConnectionPointCookie(source, sink, eventType);
        }
예제 #14
0
        protected override void DetachSink()
        {
            if (null != _cookie)
            {
                _cookie.Disconnect();
                _cookie = null;
            }

            base.DetachSink();
        }
        protected override void DetachSink()
        {
            if (webBrowserEventCookie != null)
            {
                webBrowserEventCookie.Disconnect();
                webBrowserEventCookie = null;
            }

            base.DetachSink();
        }
예제 #16
0
 protected override void DetachSink()
 {
     if (this.cookie != null)
     {
         this.cookie.Disconnect();
     }
     this.cookie = null;
     this.events = null;
     base.DetachSink();
 }
예제 #17
0
 protected override void CreateSink()
 {
     try
     {
         this.eventMulticaster = new AxShockwaveFlashEventMulticaster(this);
         this.cookie           = new AxHost.ConnectionPointCookie(this.ocx, this.eventMulticaster, typeof(_IShockwaveFlashEvents));
     }
     catch (Exception)
     {
     }
 }
예제 #18
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();
 }
        protected override void CreateSink()
        {
            base.CreateSink();

            object activeXInstance = this.ActiveXInstance;

            if (activeXInstance != null)
            {
                this.webBrowserEvent       = new CustomWebBrowserEvent(this);
                this.webBrowserEventCookie = new AxHost.ConnectionPointCookie(activeXInstance, this.webBrowserEvent, typeof(NativeWrapper.DWebBrowserEvents2));
            }
        }
        public void ConnectionPointCookie_Disconnect_InvokeMultipleTimes_Success()
        {
            Type   type      = Type.GetTypeFromCLSID(CLSID_WebBrowser);
            object source    = Activator.CreateInstance(type);
            var    sink      = new CustomPropertyNotifySink();
            Type   eventType = typeof(Ole32.IPropertyNotifySink);
            var    cookie    = new AxHost.ConnectionPointCookie(source, sink, eventType);

            cookie.Disconnect();

            // Call again.
            cookie.Disconnect();
        }
예제 #21
0
 protected override void CreateSink()
 {
     try
     {
         this.eventMulticaster = new AxRDPViewerEventMulticaster(this);
         this.cookie           = new AxHost.ConnectionPointCookie(
             this.ocx,
             this.eventMulticaster,
             typeof(_IRDPSessionEvents));
     }
     catch (Exception exception)
     {
     }
 }
예제 #22
0
 protected internal virtual void StartEvents()
 {
     if (this.connectionPoint == null && this.Host.activeXInstance != null)
     {
         try
         {
             this.connectionPoint = new AxHost.ConnectionPointCookie(this.Host.activeXInstance, this, typeof(UnsafeNativeMethods.IPropertyNotifySink));
         }
         catch (Exception ex)
         {
             if (Utils.IsCriticalException(ex))
             {
                 throw;
             }
         }
     }
 }
        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));
        }
예제 #24
0
 protected override void CreateSink()
 {
     base.CreateSink();
     this.events = new TenDayBrowserExtendedEvents(this);
     this.cookie = new AxHost.ConnectionPointCookie(base.ActiveXInstance, this.events, typeof(UnsafeNativeMethods.DTenDayBrowserEvents2));
 }
예제 #25
0
 protected override void CreateSink()
 {
     base.CreateSink();
     _events = new WebBrowserExtendedEvents(this);
     _cookie = new AxHost.ConnectionPointCookie(ActiveXInstance, _events, typeof(IDWebBrowserEvents2));
 }
예제 #26
0
 public WebBrowserEvents(WebBrowser wb)
 {
     _cookie = new AxHost.ConnectionPointCookie(wb.ActiveXInstance, this, typeof(DWebBrowserEvents2));
 }