/// <summary> /// Loads the initial values for each control based on the InitPolicy, InitFixField and InitValue attributes. /// </summary> /// <param name="controlInitValueProvider">Value provider for initializing control values from InitFixField.</param> /// <remarks>The spec states: 'If the value of the initPolicy attribute is undefined or equal to "UseValue" and the initValue attribute is /// defined then initialize with initValue. If the value is equal to "UseFixField" then attempt to initialize with the value of /// the tag specified in the initFixField attribute. If the value is equal to "UseFixField" and it is not possible to access the /// value of the specified fix tag then revert to using initValue. If the value is equal to "UseFixField", the field is not accessible, /// and initValue is not defined, then do not initialize.</remarks> public void LoadDefaults(FixFieldValueProvider controlInitValueProvider) { Control_t control = null; try { foreach (Control_t thisControl in this) { control = thisControl; thisControl.LoadInitValue(controlInitValueProvider); } } catch (System.Exception ex) { throw ThrowHelper.Rethrow(this, ex, ErrorMessages.InitControlValueError, control != null ? control.Id : "(unknown)"); } }
/// <summary> /// Sets the value of this parameter using the Control_t that references it. The resulting parameter value may be /// null if the control is not set to a value, or if it has explicitly been set via a state rule to {NULL}. /// </summary> /// <param name="control">Control to extract this parameter's new value from.</param> public ValidationResult SetValueFromControl(Control_t control) { IParameterConvertible value = control.GetValueForParameter(); try { ValidationResult result = _value.SetValueFromControl(this, value); // Update the text in the ValidationResult to include this parameter's name if (result.IsMissing) { return(new ValidationResult(ValidationResult.ResultType.Missing, ErrorMessages.NonOptionalParameterNotSupplied, Name)); } return(result); } catch (Atdl4netException ex) { throw ThrowHelper.Rethrow(this, ex, ErrorMessages.UnsuccessfulSetParameterOperation, Name, control.Id, ex.Message); } }