// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System;
using System.Collections;
private Stack _transactions;
private IServiceContainer _serviceContainer;
private bool _loading;
-
+ private bool _unloading;
public DesignerHost (IServiceProvider serviceProvider)
{
if (serviceProvider == null)
public override void Remove (IComponent component)
{
+ DesignerTransaction transaction = this.CreateTransaction ("Remove " + component.Site.Name);
RemovePreProcess (component);
base.Remove (component);
RemovePostProcess (component);
+ transaction.Commit ();
}
internal void RemovePreProcess (IComponent component)
{
- if (ComponentRemoving != null)
+ if (!_unloading && ComponentRemoving != null)
ComponentRemoving (this, new ComponentEventArgs (component));
IDesigner designer = _designers[component] as IDesigner;
internal void RemovePostProcess (IComponent component)
{
- if (ComponentRemoved != null)
+ if (!_unloading && ComponentRemoved != null)
ComponentRemoved (this, new ComponentEventArgs (component));
}
public void DestroyComponent (IComponent component)
{
if (component.Site != null && component.Site.Container == this) {
- OnComponentChanging (component, null);
-
this.Remove (component); // takes care for the designer as well
component.Dispose ();
-
- OnComponentChanged (component, null, null, null);
}
}
private void Unload ()
{
+ _unloading = true;
if (DesignerLoaderHostUnloading != null)
DesignerLoaderHostUnloading (this, EventArgs.Empty);
if (DesignerLoaderHostUnloaded != null)
DesignerLoaderHostUnloaded (this, EventArgs.Empty);
+ _unloading = false;
}
#endregion
}
}
-#endif