Author: mhabersack
Date: 2007-05-15 17:18:50 -0400 (Tue, 15 May 2007)
New Revision: 77440
Modified:
trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
trunk/mcs/class/System.Web/System.Web.UI/TemplateControl.cs
Log:
2007-05-15 Marek Habersack <[EMAIL PROTECTED]>
* TemplateControl.cs: implemented the 3-parameter overloads of
GetLocalResourceObject and GetGlobalResourceObject.
Modified: trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ChangeLog 2007-05-15 20:59:14 UTC
(rev 77439)
+++ trunk/mcs/class/System.Web/System.Web.UI/ChangeLog 2007-05-15 21:18:50 UTC
(rev 77440)
@@ -1,5 +1,8 @@
2007-05-15 Marek Habersack <[EMAIL PROTECTED]>
+ * TemplateControl.cs: implemented the 3-parameter overloads of
+ GetLocalResourceObject and GetGlobalResourceObject.
+
* TemplateParser.cs: refactoring - use HttpApplication.LoadType to
actually look up types.
Modified: trunk/mcs/class/System.Web/System.Web.UI/TemplateControl.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/TemplateControl.cs 2007-05-15
20:59:14 UTC (rev 77439)
+++ trunk/mcs/class/System.Web/System.Web.UI/TemplateControl.cs 2007-05-15
21:18:50 UTC (rev 77440)
@@ -284,11 +284,21 @@
return HttpContext.GetGlobalResourceObject (className,
resourceKey);
}
- [MonoTODO ("Not implemented")]
protected object GetGlobalResourceObject (string className,
string resourceKey, Type objType, string propName)
{
- // FIXME: not sure how to implement that one yet
- throw new NotSupportedException();
+ if (String.IsNullOrEmpty (resourceKey) ||
String.IsNullOrEmpty (propName) ||
+ String.IsNullOrEmpty (className) || objType == null)
+ return null;
+
+ object globalObject = GetGlobalResourceObject
(className, resourceKey);
+ if (globalObject == null)
+ return null;
+
+ TypeConverter converter = TypeDescriptor.GetProperties
(objType) [propName].Converter;
+ if (converter == null || !converter.CanConvertFrom
(globalObject.GetType ()))
+ return null;
+
+ return converter.ConvertFrom (globalObject);
}
protected object GetLocalResourceObject (string resourceKey)
@@ -299,8 +309,18 @@
protected object GetLocalResourceObject (string resourceKey,
Type objType, string propName)
{
- // FIXME: not sure how to implement that one yet
- throw new NotSupportedException();
+ if (String.IsNullOrEmpty (resourceKey) ||
String.IsNullOrEmpty (propName) || objType == null)
+ return null;
+
+ object localObject = GetLocalResourceObject
(resourceKey);
+ if (localObject == null)
+ return null;
+
+ TypeConverter converter = TypeDescriptor.GetProperties
(objType) [propName].Converter;
+ if (converter == null || !converter.CanConvertFrom
(localObject.GetType ()))
+ return null;
+
+ return converter.ConvertFrom (localObject);
}
#endif
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches