Beispiel #1
0
 /// <summary>
 /// Clears the cache
 /// </summary>
 /// <remarks>
 /// Subsequent access to cleared elements leads to immediate recreation. However, attached
 /// event handlers and delegate methods get orphaned.
 /// </remarks>
 public void ResetElementCache()
 {
     if (htmlEditor.ServiceProvider != null)
     {
         designerHost = (DesignerHost)htmlEditor.ServiceProvider.GetService(typeof(IDesignerHost));
         if (designerHost != null)
         {
             foreach (IComponent component in designerHost.Container.Components)
             {
                 if (component is IDisposable)
                 {
                     ((IDisposable)component).Dispose();
                 }
             }
             designerHost.Clear();
         }
     }
 }