[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/System/ComponentModel ComponentResour
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/System/ComponentModel ComponentResourceManager.cs, 1.1, 1.2 |
Date: |
Tue, 16 Sep 2003 22:25:50 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System/ComponentModel
In directory subversions:/tmp/cvs-serv7462/System/ComponentModel
Modified Files:
ComponentResourceManager.cs
Log Message:
Implement "ApplyResources" for component resource managers.
Index: ComponentResourceManager.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/System/ComponentModel/ComponentResourceManager.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** ComponentResourceManager.cs 16 Sep 2003 05:25:31 -0000 1.1
--- ComponentResourceManager.cs 17 Sep 2003 02:25:48 -0000 1.2
***************
*** 26,29 ****
--- 26,30 ----
using System.Resources;
+ using System.Collections;
using System.Globalization;
***************
*** 39,43 ****
ApplyResources(value, objectName, null);
}
- [TODO]
public virtual void ApplyResources
(Object value, String objectName, CultureInfo
culture)
--- 40,43 ----
***************
*** 59,64 ****
}
! // Read the resources and apply them to the
component.
! // TODO
}
--- 59,96 ----
}
! // Read the resources for the specified culture.
! ResourceSet set = GetResourceSet(culture, true,
true);
! if(set == null)
! {
! return;
! }
!
! // Get the properties for the object.
! PropertyDescriptorCollection props;
! props = TypeDescriptor.GetProperties(value);
!
! // Set the resources for the value.
! IDictionaryEnumerator e = set.GetEnumerator();
! while(e.MoveNext())
! {
! // Check that this key is appropriate
to the object.
! String key = (String)(e.Key);
! if(objectName == null ||
key.StartsWith(objectName))
! {
! // Remove the object name
prefix from the key.
! if(objectName != null)
! {
! key =
key.Substring(objectName.Length);
! }
!
! // Find the specified property
and set it.
! PropertyDescriptor prop;
! prop = props[key];
! if(prop != null &&
!prop.IsReadOnly)
! {
! prop.SetValue(value,
e.Value);
! }
! }
! }
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/System/ComponentModel ComponentResourceManager.cs, 1.1, 1.2,
Rhys Weatherley <address@hidden> <=