Exemplo n.º 1
0
 /// <summary>
 /// Update value-set for a not-compound parameter.
 /// </summary>
 /// <param name="valueSet">The value set to update</param>
 /// <param name="row">The value row containing the information. If null the data is retrieved from the current row.</param>
 /// <remarks>
 /// If <paramref name="row"/> is null, it means the parameter is not compound, not option dependent and not state dependent.
 /// </remarks>
 private void UpdateSimpleValueSet(ParameterSubscriptionValueSet valueSet, ParameterValueBaseRowViewModel row = null)
 {
     valueSet.ValueSwitch = row == null ? this.Switch.Value : row.Switch.Value;
     valueSet.Manual      = row == null ? new ValueArray <string>(new List <string> {
         ValueSetConverter.ToValueSetString(this.Manual, this.ParameterType)
     }) : new ValueArray <string>(new List <string> {
         ValueSetConverter.ToValueSetString(row.Manual, this.ParameterType)
     });
 }
Exemplo n.º 2
0
 /// <summary>
 /// Call the correct update method depending on kind of parameter type (scalar, compound)
 /// </summary>
 /// <param name="valueSet">The <see cref="ParameterSubscriptionValueSet"/> to update</param>
 /// <param name="row">The <see cref="ParameterValueBaseRowViewModel"/> containing the information, or if null the current row</param>
 private void RedirectUpdateCall(ParameterSubscriptionValueSet valueSet, ParameterValueBaseRowViewModel row = null)
 {
     if (this.IsCompoundType)
     {
         this.UpdateCompoundValueSet(valueSet, row);
     }
     else
     {
         this.UpdateSimpleValueSet(valueSet, row);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Call the correct update method depending on kind of parameter type (scalar, compound)
 /// </summary>
 /// <param name="valueSet">The <see cref="ParameterValueSetBase"/> to update</param>
 /// <param name="row">The <see cref="ParameterValueBaseRowViewModel"/> containing the information, or if null the current row</param>
 private void UpdateScalarOrCompoundValueSet(ParameterValueSetBase valueSet, ParameterValueBaseRowViewModel row = null)
 {
     if (this.IsCompoundType)
     {
         this.UpdateCompoundValueSet(valueSet, row);
     }
     else
     {
         this.UpdateScalarValueSet(valueSet, row);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Update value-set for a compound parameter.
        /// </summary>
        /// <param name="valueSet">The value set to update</param>
        /// <param name="row">The value row containing the information. If null the data is retrieved from the current row.</param>
        /// <remarks>
        /// If <paramref name="row"/> is null, it means the parameter is not compound, not option dependent and not state dependent.
        /// </remarks>
        private void UpdateCompoundValueSet(ParameterSubscriptionValueSet valueSet, ParameterValueBaseRowViewModel row = null)
        {
            var componentRows = (row == null)
                ? this.ContainedRows.Cast <ParameterComponentValueRowViewModel>().ToList()
                : row.ContainedRows.Cast <ParameterComponentValueRowViewModel>().ToList();

            valueSet.Manual      = new ValueArray <string>(new string[componentRows.Count]);
            valueSet.ValueSwitch = componentRows[0].Switch.Value; // all the switches should have the same value
            for (var i = 0; i < componentRows.Count; i++)
            {
                valueSet.Manual[i] = componentRows[i].Manual.ToValueSetString(this.ParameterType);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Update value-set for a scalar parameter.
 /// </summary>
 /// <param name="valueSet">The value set to update</param>
 /// <param name="row">The value row containing the information. If null the data is retrieved from the current row.</param>
 /// <remarks>
 /// If <paramref name="row"/> is null, it means the parameter is not compound, not option dependent and not state dependent.
 /// </remarks>
 private void UpdateScalarValueSet(ParameterValueSetBase valueSet, ParameterValueBaseRowViewModel row = null)
 {
     valueSet.ValueSwitch = row == null ? this.Switch.Value : row.Switch.Value;
     valueSet.Computed    = row == null ? new ValueArray <string>(new List <string> {
         this.Computed
     }) : new ValueArray <string>(new List <string> {
         row.Computed
     });
     valueSet.Manual = row == null ? new ValueArray <string>(new List <string> {
         this.Manual.ToValueSetString(this.ParameterType)
     }) : new ValueArray <string>(new List <string> {
         row.Manual.ToValueSetString(this.ParameterType)
     });
     valueSet.Reference = row == null ? new ValueArray <string>(new List <string> {
         this.Reference.ToValueSetString(this.ParameterType)
     }) : new ValueArray <string>(new List <string> {
         ValueSetConverter.ToValueSetString(row.Reference, this.ParameterType)
     });
 }