public virtual void Add(IComponent component, String name) { lock (this) { if (component == null) { return; } if (sites == null) { sites = new ShowDialogSite[4]; } else if (sites.Length == siteCount) { ShowDialogSite[] newSites = new ShowDialogSite[siteCount * 2]; Array.Copy(sites, 0, newSites, 0, siteCount); sites = newSites; } ISite site = component.Site; if (site != null) { site.Container.Remove(component); } ShowDialogSite newSite = new ShowDialogSite(component, this, name); sites[siteCount++] = newSite; component.Site = newSite; } }
public virtual void Dispose() { lock (this) { bool saveDisposing = disposing; disposing = true; try { while (siteCount > 0) { ShowDialogSite site = sites[--siteCount]; site.component.Site = null; site.component.Dispose(); } sites = null; } finally { disposing = saveDisposing; } } }