internal CustomPropertyDescriptor(object owner, PropertyDescriptor pd) : base(pd) { propertyDescriptor = pd; this.owner = owner; attributes = new AttributeList(pd.Attributes); UpdateMemberData(); }
private void UpdateResourceManager() { foreach (var cpd in propertyDescriptorList) { IResourceAttribute attr = (PropertyResourceAttribute)cpd.AllAttributes.FirstOrDefault(a => a is PropertyResourceAttribute); if (attr == null) { var ac = GetAttributes(); var al = new AttributeList(ac); attr = (ClassResourceAttribute)al.FirstOrDefault(a => a is ClassResourceAttribute); } if (attr == null) { cpd.ResourceManager = null; continue; } cpd.KeyPrefix = attr.KeyPrefix; var rm = hashRM[attr] as ResourceManager; if (rm != null) { cpd.ResourceManager = rm; continue; } try { if (String.IsNullOrWhiteSpace(attr.AssemblyFullName) == false) { rm = new ResourceManager(attr.BaseName, Assembly.ReflectionOnlyLoad(attr.AssemblyFullName)); } else { rm = new ResourceManager(attr.BaseName, base.GetPropertyOwner(cpd).GetType().Assembly); } } catch (Exception ex) { Console.WriteLine(ex.Message); continue; } hashRM.Add(attr, rm); cpd.ResourceManager = rm; } }