private void Destroy() { if (this.ExplorerBrowserNative != null) { this.viewEvents.DisconnectFromView(); this.ExplorerBrowserNative.Unadvise(this.eventCookie); ShellLightwaightNativeMethods.IUnknown_SetSite(this.ExplorerBrowserNative, null); this.ExplorerBrowserNative.Destroy(); Marshal.ReleaseComObject(this.ExplorerBrowserNative); this.ExplorerBrowserNative = null; } }
private void Create() { this.ExplorerBrowserNative = new ExplorerBrowserNative(); ShellLightwaightNativeMethods.IUnknown_SetSite(this.ExplorerBrowserNative, this); this.ExplorerBrowserNative.Advise( Marshal.GetComInterfaceForObject(this, typeof(IExplorerBrowserEvents)), out this.eventCookie); this.viewEvents = new ExplorerBrowserViewEvents(this); var rect = RECT.Create(0, 0, this.ActualWidth, this.ActualHeight); this.ExplorerBrowserNative.Initialize(this.hwndSource.Handle, ref rect, null); this.ExplorerBrowserNative.SetOptions(EXPLORER_BROWSER_OPTIONS.EBO_SHOWFRAMES); this.ExplorerBrowserNative.SetPropertyBag(this.PropertyBagName); }