Exemple #1
0
 private bool TryChangeData(string data)
 {
     _ignoreTextChange = true;
     if (Expr == null)
     {
         if ((ArrayExpressionEditor.Len == -1) || data.Contains(";"))
         {
             var items = data.Split(';');
             for (var i = 0; i < items.Length; ++i)
             {
                 items[i] = items[i].Trim();
                 if (items[i].Length == 0)
                 {
                     _ignoreTextChange = false;
                     return(false);
                 }
             }
             _definedAsConstVector = true;
             Expr = DataStorage.Add(new ArrayExpression("data", textBox1.Text, items));
             if ((ArrayExpressionEditor.Len != -1) &&
                 (items.Length != ArrayExpressionEditor.Len))
             {
                 ArrayExpressionEditor.Len = items.Length;
                 ArrayExpressionEditor.LenChanged(this);
             }
         }
         else
         {
             _definedAsConstVector = false;
             Expr =
                 DataStorage.Add(new ArrayExpression("data", textBox1.Text, data,
                                                     ArrayExpressionEditor.Len));
         }
         Expr.ValueChanged += ExprValueChanged;
     }
     else
     {
         if (data.Contains(";"))
         {
             var items = data.Split(';');
             for (var i = 0; i < items.Length; ++i)
             {
                 items[i] = items[i].Trim();
                 if (items[i].Length == 0)
                 {
                     _ignoreTextChange = false;
                     return(false);
                 }
             }
             _definedAsConstVector = true;
             Expr.SetRawExpressions(items);
             if ((ArrayExpressionEditor.Len != -1) &&
                 (items.Length != ArrayExpressionEditor.Len))
             {
                 ArrayExpressionEditor.Len = items.Length;
                 ArrayExpressionEditor.LenChanged(this);
             }
         }
         else
         {
             _definedAsConstVector = false;
             Expr.SetRawExpression(data, ArrayExpressionEditor.Len);
         }
     }
     ArrayExpressionEditor.Len = Expr.Exprs.Length;
     StepManager.RefreshToCurrentStep();
     _ignoreTextChange = false;
     return(true);
 }