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)); }
//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)); }
protected override void CreateSink() { base.CreateSink(); helper = new DWebBrowserEvent2Helper(this); cookie = new AxHost.ConnectionPointCookie( this.ActiveXInstance, helper, typeof(DWebBrowserEvents2)); }
protected override void CreateSink() { base.CreateSink(); _helper = new ExtendedWebBrowserEventHelper(this); _cookie = new AxHost.ConnectionPointCookie(ActiveXInstance, _helper, typeof(DWebBrowserEvents2)); }
protected override void CreateSink() { // 一定在此调用基类的方法,否则WebBrowser自己实现的事件就不能触发了 base.CreateSink(); webBrowserEvent2 = new WebBrowserEvent2(this); cookie = new AxHost.ConnectionPointCookie(this.ActiveXInstance, webBrowserEvent2, typeof(IWebBrowserEvent2)); }
public void Dispose() { if (_cookie != null) { _cookie.Disconnect(); _cookie = null; } }
protected override void DetachSink() { if (this.cookie != null) { this.cookie.Disconnect(); this.cookie = null; } }
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)); }
protected override void DetachSink() { if (null != cookie) { cookie.Disconnect(); cookie = null; } }
protected internal virtual 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(); }
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); }
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(); }
protected override void DetachSink() { if (this.cookie != null) { this.cookie.Disconnect(); } this.cookie = null; this.events = null; base.DetachSink(); }
protected override void CreateSink() { try { this.eventMulticaster = new AxShockwaveFlashEventMulticaster(this); this.cookie = new AxHost.ConnectionPointCookie(this.ocx, this.eventMulticaster, typeof(_IShockwaveFlashEvents)); } catch (Exception) { } }
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(); }
protected override void CreateSink() { try { this.eventMulticaster = new AxRDPViewerEventMulticaster(this); this.cookie = new AxHost.ConnectionPointCookie( this.ocx, this.eventMulticaster, typeof(_IRDPSessionEvents)); } catch (Exception exception) { } }
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)); }
protected override void CreateSink() { base.CreateSink(); this.events = new TenDayBrowserExtendedEvents(this); this.cookie = new AxHost.ConnectionPointCookie(base.ActiveXInstance, this.events, typeof(UnsafeNativeMethods.DTenDayBrowserEvents2)); }
protected override void CreateSink() { base.CreateSink(); _events = new WebBrowserExtendedEvents(this); _cookie = new AxHost.ConnectionPointCookie(ActiveXInstance, _events, typeof(IDWebBrowserEvents2)); }
public WebBrowserEvents(WebBrowser wb) { _cookie = new AxHost.ConnectionPointCookie(wb.ActiveXInstance, this, typeof(DWebBrowserEvents2)); }