Преглед на файлове

2008-01-06 Ivan N. Zlatev <[email protected]>

        * ServiceContainer.cs: Check DefaultServices in GetService in 2.0.
        * MenuCommand.cs: Invoke (args) should call Invoke () and leave
        args handling for subclasses.
        * ServiceContainerTest.cs: Test that DefaultServices is checked in 
        GetService in 2.0.


svn path=/trunk/mcs/; revision=92354
Ivan Zlatev преди 18 години
родител
ревизия
aefc708c0e

+ 6 - 0
mcs/class/System/System.ComponentModel.Design/Changelog

@@ -1,3 +1,9 @@
+2008-01-06  Ivan N. Zlatev  <[email protected]>
+
+	* ServiceContainer.cs: Check DefaultServices in GetService in 2.0.
+	* MenuCommand.cs: Invoke (args) should call Invoke () and leave
+	args handling for subclasses.
+
 2007-12-24  Gert Driesen  <[email protected]>
 
 	* CheckoutException.cs: Provide customized message and error code

+ 1 - 2
mcs/class/System/System.ComponentModel.Design/MenuCommand.cs

@@ -133,10 +133,9 @@ namespace System.ComponentModel.Design
 		}
 		
 #if NET_2_0
-		[MonoNotSupported("")]
 		public virtual void Invoke (object arg)
 		{
-			throw new NotImplementedException ();
+			this.Invoke ();
 		}
 #endif
 

+ 14 - 2
mcs/class/System/System.ComponentModel.Design/ServiceContainer.cs

@@ -137,10 +137,22 @@ namespace System.ComponentModel.Design
 #endif
 		object GetService (Type serviceType)
 		{
+#if NET_2_0
+			object result = null;
+			Type[] defaultServices = this.DefaultServices;
+			for (int i=0; i < defaultServices.Length; i++) {
+				if (defaultServices[i] == serviceType) {
+					result = this;
+					break;
+				}
+			}
+			if (result == null)
+				result = services[serviceType];
+#else
 			object result = services[serviceType];
-			if (result == null && parentProvider != null){
+#endif
+			if (result == null && parentProvider != null)
 				result = parentProvider.GetService (serviceType);
-			}
 			if (result != null) {
 				ServiceCreatorCallback	cb = result as ServiceCreatorCallback;
 				if (cb != null) {

+ 5 - 0
mcs/class/System/Test/System.ComponentModel.Design/ChangeLog

@@ -1,3 +1,8 @@
+2008-01-06  Ivan N. Zlatev  <[email protected]>
+
+	* ServiceContainerTest.cs: Test that DefaultServices is checked in
+	GetService in 2.0.
+
 2007-12-24  Gert Driesen  <[email protected]>
 
 	* CheckoutExceptionTest.cs: Added test for ctors and Canceled.

+ 9 - 0
mcs/class/System/Test/System.ComponentModel.Design/ServiceContainerTest.cs

@@ -69,6 +69,15 @@ public class ServiceContainerTest : Assertion {
 		sc.AddService (typeof (Svc), new Svc());
 	}
 
+#if NET_2_0
+	[Test]
+	public void TestGetServiceDefaultServices ()
+	{
+		ServiceContainer sc = new ServiceContainer ();
+		AssertEquals ("TGDS#01", sc.GetService (typeof(IServiceContainer)), sc);
+		AssertEquals ("TGDS#02", sc.GetService (typeof(ServiceContainer)), sc);
+	}
+#endif
 	[Test]
 	public void TestServiceCreator () 
 	{