Example #1
0
        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> AddWindowShim - adds a HtmlWindowShim to list of shims to manage 
            ///</devdoc>

            public void AddWindowShim(HtmlWindow window) {
                HtmlWindow.HtmlWindowShim shim = null;
                if (htmlWindowShims == null) {
                    htmlWindowShims = new Dictionary<HtmlWindow,HtmlWindow.HtmlWindowShim>();
                    shim = new HtmlWindow.HtmlWindowShim(window);
                    htmlWindowShims[window] = shim;
                }
                else if (!htmlWindowShims.ContainsKey(window)) {
                    shim = new HtmlWindow.HtmlWindowShim(window);
                    htmlWindowShims[window] = shim;
                }
                if (shim != null) {
                   // strictly not necessary, but here for future use.
                   OnShimAdded(shim);
                }
            }
 public void AddWindowShim(HtmlWindow window)
 {
     HtmlWindow.HtmlWindowShim addedShim = null;
     if (this.htmlWindowShims == null)
     {
         this.htmlWindowShims         = new Dictionary <HtmlWindow, HtmlWindow.HtmlWindowShim>();
         addedShim                    = new HtmlWindow.HtmlWindowShim(window);
         this.htmlWindowShims[window] = addedShim;
     }
     else if (!this.htmlWindowShims.ContainsKey(window))
     {
         addedShim = new HtmlWindow.HtmlWindowShim(window);
         this.htmlWindowShims[window] = addedShim;
     }
     if (addedShim != null)
     {
         this.OnShimAdded(addedShim);
     }
 }
 public void AddWindowShim(HtmlWindow window)
 {
     HtmlWindow.HtmlWindowShim addedShim = null;
     if (this.htmlWindowShims == null)
     {
         this.htmlWindowShims = new Dictionary<HtmlWindow, HtmlWindow.HtmlWindowShim>();
         addedShim = new HtmlWindow.HtmlWindowShim(window);
         this.htmlWindowShims[window] = addedShim;
     }
     else if (!this.htmlWindowShims.ContainsKey(window))
     {
         addedShim = new HtmlWindow.HtmlWindowShim(window);
         this.htmlWindowShims[window] = addedShim;
     }
     if (addedShim != null)
     {
         this.OnShimAdded(addedShim);
     }
 }
Example #5
0
        /// <summary> AddWindowShim - adds a HtmlWindowShim to list of shims to manage
        ///</summary>

        public void AddWindowShim(HtmlWindow window)
        {
            HtmlWindow.HtmlWindowShim shim = null;
            if (htmlWindowShims == null)
            {
                htmlWindowShims         = new Dictionary <HtmlWindow, HtmlWindow.HtmlWindowShim>();
                shim                    = new HtmlWindow.HtmlWindowShim(window);
                htmlWindowShims[window] = shim;
            }
            else if (!htmlWindowShims.ContainsKey(window))
            {
                shim = new HtmlWindow.HtmlWindowShim(window);
                htmlWindowShims[window] = shim;
            }
            if (shim != null)
            {
                // strictly not necessary, but here for future use.
                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();
         }
     }
 }