private VirtualProperty(int id, int groupId, string name, Type type, int length, TypeConverter converter, VirtualPropertyOption options, Func<VirtualProperty, string> getLocalizedNameCallback) { if (name == null) { throw new ArgumentNullException(); } if (name == string.Empty) { throw new ArgumentException(); } this.PropertyId = id; this.GroupId = groupId; this.PropertyName = name; this.PropertyType = type; this.PropertyLength = length; this.PropertyConverter = converter; this.PropertyOptions = options; this.GetLocalizedNameCallback = getLocalizedNameCallback; }
public static int RegisterProperty(string name, int groupId, System.Type type, int length, TypeConverter converter, VirtualPropertyOption options) { VirtualProperty property = VirtualProperty.Get(name); if (property != null) { return property.PropertyId; } return VirtualProperty.RegisterProperty(name, groupId, type, length, converter, options, new Func<VirtualProperty, string>(DefaultProperty.GetLocalizedPropertyName)); }
public static int RegisterProperty(string name, int groupId, System.Type type, int length, VirtualPropertyOption options) { return RegisterProperty(name, groupId, type, length, null, options); }
public static int RegisterProperty(string name, int groupId, Type type, int length, TypeConverter converter, VirtualPropertyOption options, Func<VirtualProperty, string> getLocalizedNameCallback) { VirtualProperty property; if (PropertyMap.TryGetValue(name, out property)) { throw new ArgumentException(string.Format("Property with name '{0}' already registered.", name)); } if ((converter == null) && type.IsEnum) { converter = TypeDescriptor.GetConverter(type); } property = new VirtualProperty(PropertyList.Count, groupId, name, type, length, converter, options, getLocalizedNameCallback); PropertyList.Add(property); PropertyMap.Add(name, property); FAllSet = null; FVisibleSet = null; return property.PropertyId; }