Author: gonzalo
Date: 2006-09-11 19:01:01 -0400 (Mon, 11 Sep 2006)
New Revision: 65262
Modified:
trunk/mcs/class/System/System.ComponentModel.Design/Changelog
trunk/mcs/class/System/System.ComponentModel.Design/ServiceContainer.cs
Log:
2006-09-11 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
* ServiceContainer.cs: update for 2.0. Patch by Ivan N. Zlatev.
Modified: trunk/mcs/class/System/System.ComponentModel.Design/Changelog
===================================================================
--- trunk/mcs/class/System/System.ComponentModel.Design/Changelog
2006-09-11 22:57:06 UTC (rev 65261)
+++ trunk/mcs/class/System/System.ComponentModel.Design/Changelog
2006-09-11 23:01:01 UTC (rev 65262)
@@ -1,3 +1,7 @@
+2006-09-11 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+ * ServiceContainer.cs: update for 2.0. Patch by Ivan N. Zlatev.
+
2006-05-31 Gert Driesen <[EMAIL PROTECTED]>
* DesignerCollection.cs: Added explicit interface implemenation for
Modified:
trunk/mcs/class/System/System.ComponentModel.Design/ServiceContainer.cs
===================================================================
--- trunk/mcs/class/System/System.ComponentModel.Design/ServiceContainer.cs
2006-09-11 22:57:06 UTC (rev 65261)
+++ trunk/mcs/class/System/System.ComponentModel.Design/ServiceContainer.cs
2006-09-11 23:01:01 UTC (rev 65262)
@@ -4,10 +4,11 @@
// Authors:
// Martin Willemoes Hansen ([EMAIL PROTECTED])
// Andreas Nahr ([EMAIL PROTECTED])
+// Ivan N. Zlatev (contact i-nZ.net)
//
// (C) 2003 Martin Willemoes Hansen
// (C) 2003 Andreas Nahr
-//
+// (C) 2006 Ivan N. Zlatev
//
// Permission is hereby granted, free of charge, to any person obtaining
@@ -30,16 +31,25 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using System;
using System.Collections;
namespace System.ComponentModel.Design
{
+
+#if NET_2_0
+ public class ServiceContainer : IServiceContainer, IServiceProvider,
IDisposable
+#else
public sealed class ServiceContainer : IServiceContainer,
IServiceProvider
+#endif
{
private IServiceProvider parentProvider;
private Hashtable services = new Hashtable ();
-
+#if NET_2_0
+ private bool _disposed = false;
+#endif
+
public ServiceContainer()
: this (null)
{
@@ -94,8 +104,12 @@
{
RemoveService (serviceType, false);
}
-
- public void RemoveService (Type serviceType, bool promote)
+
+#if NET_2_0
+ public virtual void RemoveService (Type serviceType, bool
promote)
+#else
+ public void RemoveService (Type serviceType, bool promote)
+#endif
{
if (serviceType == null)
throw new ArgumentNullException ("serviceType",
"Cannot be null");
@@ -122,5 +136,36 @@
}
return result;
}
+
+#if NET_2_0
+ public void Dispose ()
+ {
+ this.Dispose (true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!_disposed) {
+ if (disposing) {
+ if (this.services != null) {
+ foreach (object obj in
this.services) {
+ if (obj is IDisposable)
{
+ ((IDisposable)
obj).Dispose ();
+ }
+ }
+ this.services = null;
+ }
+ }
+ _disposed = true;
+ }
+ }
+
+ ~ServiceContainer ()
+ {
+ Dispose (false);
+ }
+#endif
+
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches