public FeatureFactory AddColorPicker(ControlLocation location = null, EControlUse controlUse = EControlUse.NotSpecified) { var targetRange = new ValueRange(0, 16777215); if (_feature.HasControlForRange(targetRange)) { throw new ArgumentException($"Some or all of the values in the range {targetRange.Min}-{targetRange.Max} already has a control bound to it.", nameof(targetRange)); } var colorPicker = new StatusControl(EControlType.ColorPicker) { TargetRange = targetRange, ControlUse = controlUse, Location = location ?? new ControlLocation() }; _feature.AddStatusControl(colorPicker); return(this); }
/// <summary> /// Add a color picker control to the feature /// </summary> /// <remarks> /// Color pickers do not use the value of the feature to operate. They use a control string; /// so the <see cref="targetValue"/> is superficial and does not correspond to the actual selected color. /// </remarks> /// <param name="targetValue">The value this control occupies on the feature.</param> /// <param name="location">The location of the control in the grid</param> /// <param name="controlUse">The specific use for this control</param> /// <returns>A FeatureFactory with the new color control added</returns> /// <exception cref="ArgumentException">Thrown when a control, targeting the specified value, already exists</exception> public FeatureFactory AddColorPicker(double targetValue, ControlLocation location = null, EControlUse controlUse = EControlUse.NotSpecified) { if (_feature.HasControlForValue(targetValue)) { throw new ArgumentException($"The value {targetValue} already has a control bound to it.", nameof(targetValue)); } var colorPicker = new StatusControl(EControlType.ColorPicker) { TargetValue = targetValue, ControlUse = controlUse, Location = location ?? new ControlLocation() }; _feature.AddStatusControl(colorPicker); return(this); }
public FeatureFactory AddRadioSelectList(SortedDictionary <string, double> textOptions, ControlLocation location = null, EControlUse controlUse = EControlUse.NotSpecified) { if (textOptions == null) { throw new ArgumentNullException(nameof(textOptions)); } foreach (var textOption in textOptions) { if (_feature.HasControlForValue(textOption.Value)) { throw new ArgumentException($"The value {textOption.Value} already has a control bound to it.", nameof(textOptions)); } //TODO radio select list location var dropDownOption = new StatusControl(EControlType.RadioOption) { TargetValue = textOption.Value, Label = textOption.Key, ControlUse = controlUse, Location = location ?? new ControlLocation() }; _feature.AddStatusControl(dropDownOption); } return(this); }
public FeatureFactory AddValueDropDown(ValueRange targetRange, ControlLocation location = null, EControlUse controlUse = EControlUse.NotSpecified) { if (targetRange == null) { throw new ArgumentNullException(nameof(targetRange)); } if (_feature.HasControlForRange(targetRange)) { throw new ArgumentException($"Some or all of the values in the range {targetRange.Min}-{targetRange.Max} already has a control bound to it.", nameof(targetRange)); } var dropDown = new StatusControl(EControlType.ValueRangeDropDown) { TargetRange = targetRange, ControlUse = controlUse, Location = location ?? new ControlLocation() }; _feature.AddStatusControl(dropDown); return(this); }
public FeatureFactory AddNumberInputField(double targetValue, string hintText, ControlLocation location = null, EControlUse controlUse = EControlUse.NotSpecified) { if (string.IsNullOrWhiteSpace(hintText)) { throw new ArgumentNullException(nameof(hintText)); } if (_feature.HasControlForValue(targetValue)) { throw new ArgumentException($"The value {targetValue} already has a control bound to it.", nameof(targetValue)); } var numInput = new StatusControl(EControlType.TextBoxNumber) { TargetValue = targetValue, Label = hintText, ControlUse = controlUse, Location = location ?? new ControlLocation() }; _feature.AddStatusControl(numInput); return(this); }
//Add Controls public FeatureFactory AddButton(double targetValue, string targetStatus, ControlLocation location = null, EControlUse controlUse = EControlUse.NotSpecified) { if (string.IsNullOrWhiteSpace(targetStatus)) { throw new ArgumentNullException(nameof(targetStatus)); } if (_feature.HasControlForValue(targetValue)) { throw new ArgumentException($"The value {targetValue} already has a control bound to it.", nameof(targetValue)); } var button = new StatusControl(EControlType.Button) { TargetValue = targetValue, Label = targetStatus, ControlUse = controlUse, Location = location ?? new ControlLocation() }; _feature.AddStatusControl(button); return(this); }