internal void OnWindowUnloaded(HtmlWindow unloadedWindow) { Debug.Assert(unloadedWindow != null, "Why are we calling this with a null window?"); if (unloadedWindow != null) { // // prune documents // if (htmlDocumentShims != null) { HtmlDocument.HtmlDocumentShim[] shims = new HtmlDocument.HtmlDocumentShim[htmlDocumentShims.Count]; htmlDocumentShims.Values.CopyTo(shims, 0); foreach (HtmlDocument.HtmlDocumentShim shim in shims) { if (shim.AssociatedWindow == unloadedWindow.NativeHtmlWindow) { htmlDocumentShims.Remove(shim.Document); shim.Dispose(); } } } // // prune elements // if (htmlElementShims != null) { HtmlElement.HtmlElementShim[] shims = new HtmlElement.HtmlElementShim[htmlElementShims.Count]; htmlElementShims.Values.CopyTo(shims, 0); foreach (HtmlElement.HtmlElementShim shim in shims) { if (shim.AssociatedWindow == unloadedWindow.NativeHtmlWindow) { htmlElementShims.Remove(shim.Element); shim.Dispose(); } } } // // prune the particular window from the list. // if (htmlWindowShims != null) { if (htmlWindowShims.ContainsKey(unloadedWindow)) { HtmlWindow.HtmlWindowShim shim = htmlWindowShims[unloadedWindow]; htmlWindowShims.Remove(unloadedWindow); shim.Dispose(); } } } }
/// <devdoc> AddDocumentShim - adds a HtmlDocumentShim to list of shims to manage /// Can create a WindowShim as a side effect so it knows when to self prune from the list. ///</devdoc> public void AddDocumentShim(HtmlDocument doc) { HtmlDocument.HtmlDocumentShim shim = null; if (htmlDocumentShims == null) { htmlDocumentShims = new Dictionary<HtmlDocument,HtmlDocument.HtmlDocumentShim>(); shim = new HtmlDocument.HtmlDocumentShim(doc); htmlDocumentShims[doc] = shim; } else if (!htmlDocumentShims.ContainsKey(doc)) { shim = new HtmlDocument.HtmlDocumentShim(doc); htmlDocumentShims[doc] = shim; } if (shim != null) { OnShimAdded(shim); } }
public void AddDocumentShim(HtmlDocument doc) { HtmlDocument.HtmlDocumentShim addedShim = null; if (this.htmlDocumentShims == null) { this.htmlDocumentShims = new Dictionary <HtmlDocument, HtmlDocument.HtmlDocumentShim>(); addedShim = new HtmlDocument.HtmlDocumentShim(doc); this.htmlDocumentShims[doc] = addedShim; } else if (!this.htmlDocumentShims.ContainsKey(doc)) { addedShim = new HtmlDocument.HtmlDocumentShim(doc); this.htmlDocumentShims[doc] = addedShim; } if (addedShim != null) { this.OnShimAdded(addedShim); } }
public void AddDocumentShim(HtmlDocument doc) { HtmlDocument.HtmlDocumentShim addedShim = null; if (this.htmlDocumentShims == null) { this.htmlDocumentShims = new Dictionary<HtmlDocument, HtmlDocument.HtmlDocumentShim>(); addedShim = new HtmlDocument.HtmlDocumentShim(doc); this.htmlDocumentShims[doc] = addedShim; } else if (!this.htmlDocumentShims.ContainsKey(doc)) { addedShim = new HtmlDocument.HtmlDocumentShim(doc); this.htmlDocumentShims[doc] = addedShim; } if (addedShim != null) { this.OnShimAdded(addedShim); } }
/// <summary> AddDocumentShim - adds a HtmlDocumentShim to list of shims to manage /// Can create a WindowShim as a side effect so it knows when to self prune from the list. ///</summary> public void AddDocumentShim(HtmlDocument doc) { HtmlDocument.HtmlDocumentShim shim = null; if (htmlDocumentShims == null) { htmlDocumentShims = new Dictionary <HtmlDocument, HtmlDocument.HtmlDocumentShim>(); shim = new HtmlDocument.HtmlDocumentShim(doc); htmlDocumentShims[doc] = shim; } else if (!htmlDocumentShims.ContainsKey(doc)) { shim = new HtmlDocument.HtmlDocumentShim(doc); htmlDocumentShims[doc] = shim; } if (shim != null) { OnShimAdded(shim); } }
internal void OnWindowUnloaded(HtmlWindow unloadedWindow) { if (unloadedWindow != null) { if (this.htmlDocumentShims != null) { HtmlDocument.HtmlDocumentShim[] array = new HtmlDocument.HtmlDocumentShim[this.htmlDocumentShims.Count]; this.htmlDocumentShims.Values.CopyTo(array, 0); foreach (HtmlDocument.HtmlDocumentShim shim in array) { if (shim.AssociatedWindow == unloadedWindow.NativeHtmlWindow) { this.htmlDocumentShims.Remove(shim.Document); shim.Dispose(); } } } if (this.htmlElementShims != null) { HtmlElement.HtmlElementShim[] shimArray2 = new HtmlElement.HtmlElementShim[this.htmlElementShims.Count]; this.htmlElementShims.Values.CopyTo(shimArray2, 0); foreach (HtmlElement.HtmlElementShim shim2 in shimArray2) { if (shim2.AssociatedWindow == unloadedWindow.NativeHtmlWindow) { this.htmlElementShims.Remove(shim2.Element); shim2.Dispose(); } } } if ((this.htmlWindowShims != null) && this.htmlWindowShims.ContainsKey(unloadedWindow)) { HtmlWindow.HtmlWindowShim shim3 = this.htmlWindowShims[unloadedWindow]; this.htmlWindowShims.Remove(unloadedWindow); shim3.Dispose(); } } }
/// <devdoc> /// HtmlWindowShim calls back on us when it has unloaded the page. At this point we need to /// walk through our lists and make sure we've cleaned up /// </devdoc> internal void OnWindowUnloaded(HtmlWindow unloadedWindow) { Debug.Assert(unloadedWindow != null, "Why are we calling this with a null window?"); if (unloadedWindow != null) { // // prune documents // if (htmlDocumentShims != null) { HtmlDocument.HtmlDocumentShim[] shims = new HtmlDocument.HtmlDocumentShim[htmlDocumentShims.Count]; htmlDocumentShims.Values.CopyTo(shims,0); foreach (HtmlDocument.HtmlDocumentShim shim in shims) { if (shim.AssociatedWindow == unloadedWindow.NativeHtmlWindow) { htmlDocumentShims.Remove(shim.Document); shim.Dispose(); } } } // // prune elements // if (htmlElementShims != null) { HtmlElement.HtmlElementShim[] shims = new HtmlElement.HtmlElementShim[htmlElementShims.Count]; htmlElementShims.Values.CopyTo(shims,0); foreach (HtmlElement.HtmlElementShim shim in shims) { if (shim.AssociatedWindow == unloadedWindow.NativeHtmlWindow) { htmlElementShims.Remove(shim.Element); shim.Dispose(); } } } // // prune the particular window from the list. // if (htmlWindowShims != null) { if (htmlWindowShims.ContainsKey(unloadedWindow)) { HtmlWindow.HtmlWindowShim shim = htmlWindowShims[unloadedWindow]; htmlWindowShims.Remove(unloadedWindow); shim.Dispose(); } } } }