/// <summary>
 /// SYNTAX: Config get myVar
 /// </summary>
 /// <param name="args">Command line paramters</param>
 private static void GetVariable(string[] args)
 {
     if (args.Length == 2)
     {
         string variableName = args[1];
         try
         {
             Epi.PermanentVariable perm = (PermanentVariable) new MemoryRegion().GetVariable(variableName);
             MessageBox.Show(variableName + " = " + perm.Expression, "Epi Info 7", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         catch (Exception ex)
         {
             Console.WriteLine(string.Empty);
         }
     }
 }
Exemplo n.º 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();
         }
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// SYNTAX: Config set myVar "string value"
 /// </summary>
 /// <param name="args">Command line parameters</param>
 private static void SetVariable(string[] args)
 {
     if (args.Length > 2)
     {
         string variableName = args[1];
         string variableValue = args[2];
         Epi.PermanentVariable perm;
         if (args.Length == 3)
         {
             perm = new PermanentVariable(variableName, DataType.Text);
         }
         else
         {
             perm = new PermanentVariable(variableName, GetDataType(args[3]));
         }
         try
         {
             new MemoryRegion().DefineVariable(perm);
         }
         catch (Exception ex)
         {
             //
         }
         perm.Expression = variableValue;
     }
 }