private void SetupPropertyAfterInitialize(object obj, string name, Type propertyType, object value, string category, string description, string editor, string typeConverter) { if (HasTypeConverter(obj, propertyType, typeConverter)) { PropertyDetail spec = Properties[Properties.IndexOf(name)]; if (propertyType == typeof(Interval)) { spec.DefaultValue = value; } else { HandleReadOnly(value, spec); } values[name] = value; } else { if (value != null && value != obj) { PropertyDetail spec = Properties[Properties.IndexOf(name)]; PropertyTable table = (PropertyTable)values[name]; table.UpdateAfterInitialize(); } } }
private void HandleReadOnly(object value, PropertyDetail detail) { if (value == null || !value.Equals(detail.DefaultValue)) { detail.IsReadOnly = true; detail.Description = "READ ONLY: Properties that you set in OnInitialize() are read only to the GUI because project settings apply before and get overwritten by OnInitialize()."; } }
PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty() { PropertyDetail propertySpec = null; if(defaultProperty != null) { int index = properties.IndexOf(defaultProperty); propertySpec = properties[index]; } if(propertySpec != null) return new PropertyDetailDescriptor(propertySpec, this, propertySpec.Name, null); else return null; }
private void SetPropertyFromProjectFile(object obj, string name, Type propertyType, object value, string category, string description, string editor, string typeConverter) { if (HasTypeConverter(obj, propertyType, typeConverter)) { PropertyDetail spec = Properties[Properties.IndexOf(name)]; values[name] = value; } else { if (value != null && value != obj) { PropertyDetail spec = Properties[Properties.IndexOf(name)]; PropertyTable table = (PropertyTable)values[name]; table.UpdateAfterProjectFile(); } } }
private void SetupProperty(object obj, string name, Type propertyType, object value, string category, string description, string editor, string typeConverter) { if (propertyType.FullName.Equals("TickZoom.Api.Elapsed")) { editor = "ElapsedPropertyEditor"; typeConverter = typeof(ElapsedTypeConverter).AssemblyQualifiedName; } if (propertyType == typeof(TimeStamp)) { editor = "TimestampPropertyEditor"; typeConverter = typeof(TimestampTypeConverter).AssemblyQualifiedName; } if (propertyType == typeof(Interval)) { editor = "IntervalPropertyEditor"; typeConverter = typeof(IntervalTypeConverter).AssemblyQualifiedName; } if (propertyType == typeof(Interval)) { editor = "IntervalPropertyEditor"; typeConverter = typeof(IntervalTypeConverter).AssemblyQualifiedName; } if (HasTypeConverter(obj, propertyType, typeConverter)) { PropertyDetail detail = new PropertyDetail(name, propertyType, category, description, value, editor, typeConverter); this.Properties.Add(detail); this.DefaultProperty = name; values[name] = value; } else { if (value != null && !value.Equals(obj)) { PropertyTable table = new PropertyTable(value); PropertyDetail detail = new PropertyDetail(name, table.GetType(), category, description); this.Properties.Add(detail); values[name] = table; } } }
public abstract void SetValue(PropertyDetail item, object value);
public abstract object GetValue(PropertyDetail item);
public PropertyDetailDescriptor(PropertyDetail item, PropertyStore store, string name, Attribute[] attrs) : base(name, attrs) { this.store = store; this.info = item; }
public PropertyDetailEventArgs(PropertyDetail property, object val) { this.property = property; this.val = val; }
public override void SetValue(PropertyDetail item, object value) { values[item.Name] = value; }
public override object GetValue(PropertyDetail item) { return(values[item.Name]); }