private static void SetVariableViaDialog(string[] args)
 {
     if (args.Length > 2)
     {
         string variableName = args[1];
         string prompt       = args[2];
         Epi.PermanentVariable perm;
         DataType dataType;
         if (args.Length == 3)
         {
             dataType = DataType.Text;
         }
         else
         {
             dataType = GetDataType(args[3]);
         }
         perm = new PermanentVariable(variableName, dataType);
         try
         {
             new MemoryRegion().DefineVariable(perm);
         }
         catch (Exception ex)
         {
             //
         }
         VariableInputDialog dialog = new VariableInputDialog(dataType, prompt);
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             perm.Expression = dialog.Result.ToString();
         }
     }
 }
示例#2
0
 private static void SetVariableViaDialog(string[] args)
 {
     if (args.Length > 2)
     {
         string variableName = args[1];
         string prompt = args[2];
         Epi.PermanentVariable perm;
         DataType dataType;
         if (args.Length == 3)
         {
             dataType = DataType.Text;
         }
         else
         {
             dataType = GetDataType(args[3]);
         }
         perm = new PermanentVariable(variableName, dataType);
         try
         {
             new MemoryRegion().DefineVariable(perm);
         }
         catch (Exception ex)
         {
             //
         }
         VariableInputDialog dialog = new VariableInputDialog(dataType, prompt);
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             perm.Expression = dialog.Result.ToString();
         }
     }
 }