/// <inheritdoc/> protected void OnValueChanged(OptionItem source, object oldValue, object newValue) { if (PropertyChanged != null) { PropertyChanged(source, valuePCEA); } }
/// <inheritdoc/> protected void OnPropertyChanged(OptionItem source, object oldValue, object newValue) { if (!SuppressEvents && PropertyChanged != null) { PropertyChanged(source, new OptionValueChangedEventArgs(source.Name, source.ID, oldValue, newValue, IsUndefined)); } }
/// <summary> /// Convenience method to add a OptionItem for <see cref="Color"/> values to this handler /// </summary> /// <param name="itemName">The name of the item</param> /// <param name="initialValue">The initial value of the item</param> /// <returns>A new instance of <see cref="OptionItem"/></returns> public IOptionItem AddColor(string itemName, Color initialValue) { OptionItem newItem = new OptionItem(itemName) { Value = initialValue, Type = typeof(Color) }; AddOptionItem(newItem); return(newItem); }
/// <summary> /// Convenience method to add a <see cref="OptionItem"/> to this group /// </summary> /// <param name="itemName">The name of the item</param> /// <param name="initialValue">The initial value of the item</param> /// <returns>A new instance of <see cref="OptionItem"/></returns> public IOptionItem AddString(string itemName, string initialValue) { OptionItem newItem = new OptionItem(itemName) { Value = initialValue, Type = typeof(string) }; AddOptionItem(newItem); return(newItem); }
/// <summary> /// Convenience method to add a <see cref="OptionItem"/> to this group /// </summary> /// <param name="itemName">The name of the item</param> /// <param name="initialValue">The initial value of the item</param> /// <returns>A new instance of <see cref="OptionItem"/></returns> public IOptionItem AddDouble(string itemName, double initialValue) { OptionItem newItem = new OptionItem(itemName) { Value = initialValue, Type = typeof(double) }; AddOptionItem(newItem); return(newItem); }
/// <summary> /// Convenience method to add a <see cref="OptionItem"/> to this group /// </summary> /// <param name="itemName">The name of the item</param> /// <param name="initialValue">The initial value of the item</param> /// <returns>A new instance of <see cref="OptionItem"/></returns> public IOptionItem AddBool(string itemName, bool initialValue) { OptionItem newItem = new OptionItem(itemName) { Value = initialValue, Type = typeof(bool) }; AddOptionItem(newItem); return(newItem); }
/// <summary> /// Convenience method to add an <see cref="OptionItem"/> to this group /// </summary> /// <param name="itemName">The name of the item</param> /// <param name="initialValue">The initial value of the item</param> /// <returns>A new instance of <see cref="OptionItem"/></returns> public IOptionItem AddInt(string itemName, int initialValue) { OptionItem newItem = new OptionItem(itemName) { Value = initialValue, Type = typeof(int) }; AddOptionItem(newItem); return(newItem); }
/// <summary> /// Convenience method to add a <see cref="OptionItem"/> to this group /// </summary> /// <param name="itemName">The name of the item</param> /// <param name="initialValue">The initial value of the item</param> /// <param name="minValue">The minimum allowed value.</param> /// <param name="maxValue">The maximum allowed value.</param> /// <returns>A new instance of <see cref="OptionItem"/></returns> public IOptionItem AddDouble(string itemName, double initialValue, double minValue, double maxValue) { OptionItem newItem = new OptionItem(itemName) { Value = initialValue, Type = typeof(double) }; #if UseDataAnnotations newItem.Attributes[OptionItem.ValidationAttributesAttribute] = new List<ValidationAttribute>() {new RangeAttribute(minValue, maxValue)}; #else newItem.Attributes[OptionItem.ValidationRulesAttribute] = new List<ValidationRule>() { new RangeValidationRule<double>(minValue, maxValue) }; #endif AddOptionItem(newItem); return newItem; }
private void AddItemToGroup(OptionItem item, string groupName) { if (groupName == null) { this.AddOptionItem(item); } else { IOptionGroup group; if (groupMap.ContainsKey(groupName)) { group = groupMap[groupName]; } else { group = AddGroup(groupName); } group.AddOptionItem(item); } }
/// <summary> /// Convenience method to add an <see cref="OptionItem"/> to this group /// </summary> /// <param name="itemName">The name of the item</param> /// <param name="initialValue">The initial value of the item</param> /// <param name="minValue">The minimum allowed value.</param> /// <param name="maxValue">The maximum allowed value.</param> /// <returns>A new instance of <see cref="OptionItem"/></returns> public IOptionItem AddInt(string itemName, int initialValue, int minValue, int maxValue) { OptionItem newItem = new OptionItem(itemName) { Value = initialValue, Type = typeof(int) }; #if UseDataAnnotations newItem.Attributes[OptionItem.ValidationAttributesAttribute] = new List <ValidationAttribute>() { new RangeAttribute(minValue, maxValue) }; #else newItem.Attributes[OptionItem.ValidationRulesAttribute] = new List <ValidationRule>() { new RangeValidationRule <int>(minValue, maxValue) }; #endif AddOptionItem(newItem); return(newItem); }