X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem.Design%2FSystem.ComponentModel.Design%2FDesignerHost.cs;h=11852dc4bac8824b45de004f0294c6d8d7ffb8f1;hb=b03e60628764d66654147bfc7a7e1a3242559888;hp=c46187fdaf9914300f1d339317dec1cb37e0e05e;hpb=b4695991d8a495d82181edc4b9a0825ecbfe71fe;p=mono.git diff --git a/mcs/class/System.Design/System.ComponentModel.Design/DesignerHost.cs b/mcs/class/System.Design/System.ComponentModel.Design/DesignerHost.cs index c46187fdaf9..11852dc4bac 100644 --- a/mcs/class/System.Design/System.ComponentModel.Design/DesignerHost.cs +++ b/mcs/class/System.Design/System.ComponentModel.Design/DesignerHost.cs @@ -27,7 +27,6 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#if NET_2_0 using System; using System.Collections; @@ -85,7 +84,7 @@ namespace System.ComponentModel.Design private Stack _transactions; private IServiceContainer _serviceContainer; private bool _loading; - + private bool _unloading; public DesignerHost (IServiceProvider serviceProvider) { if (serviceProvider == null) @@ -158,14 +157,16 @@ namespace System.ComponentModel.Design 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; @@ -186,7 +187,7 @@ namespace System.ComponentModel.Design internal void RemovePostProcess (IComponent component) { - if (ComponentRemoved != null) + if (!_unloading && ComponentRemoved != null) ComponentRemoved (this, new ComponentEventArgs (component)); } @@ -354,12 +355,8 @@ namespace System.ComponentModel.Design 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); } } @@ -493,6 +490,7 @@ namespace System.ComponentModel.Design private void Unload () { + _unloading = true; if (DesignerLoaderHostUnloading != null) DesignerLoaderHostUnloading (this, EventArgs.Empty); @@ -506,6 +504,7 @@ namespace System.ComponentModel.Design if (DesignerLoaderHostUnloaded != null) DesignerLoaderHostUnloaded (this, EventArgs.Empty); + _unloading = false; } #endregion @@ -594,4 +593,3 @@ namespace System.ComponentModel.Design } } -#endif