Пример #1
0
 public LoopComponentData(IComponentValueStore valueStore, string id)
     : base(valueStore, id)
 {
     parametersData = new ObservableCollection <LoopParameterData>();
     iterationsData = new ObservableCollection <LoopExpressionData>();
     // minimum number of parameter is 1
     AddParameter(null, false);
     // expression id is <id>_e, condition id is <id>_c
     expressionData = new LoopExpressionData(valueStore, GetExpressionId());
     conditionData  = new LoopExpressionData(valueStore, GetConditionId());
 }
Пример #2
0
 public void DeleteParameter()
 {
     // minimum number of parameter is 1
     if (parametersData.Count > 1)
     {
         LoopParameterData  parameterData = parametersData.Last();
         LoopExpressionData iterationData = iterationsData.Last();
         parametersData.RemoveAt(parametersData.Count - 1);
         iterationsData.RemoveAt(iterationsData.Count - 1);
         valueStore.DeleteLoopParameter(parameterData, iterationData);
     }
 }
Пример #3
0
        public void AddParameter(string paramName = null, bool callValueStore = true)
        {
            if (paramName == null)
            {
                int i = parametersData.Count + 1;
                paramName = "p" + i;
            }
            // the parameter id is in the form <id>_p0, <id>_p1, so on
            // the iteration id is in the form <id>_i0, <id>_i1, so on
            LoopParameterData parameterData = new LoopParameterData(valueStore)
            {
                id = GetParameterId(parametersData.Count), varname = paramName
            };

            parametersData.Add(parameterData);
            LoopExpressionData iterationData = new LoopExpressionData(valueStore, GetIterationId(parametersData.Count));

            iterationsData.Add(iterationData);
            if (callValueStore)
            {
                valueStore.AddLoopParameter(parameterData, iterationData);
            }
        }