C# - 在不退出的情况下从运行winform应用程序返回字符串

时间:2016-04-02 20:59:38

标签: c# winforms

我正在开发一个winform应用程序,该应用程序在运行时从cmd(或任何其他命令发送程序)中获取参数。我在运行时成功获取了args,但是我已经将命令执行的字符串作为字符串返回而不退出应用程序。

让我们说,我执行php脚本就像给我正在运行的应用程序args:

bool finished
while(!finished) //Loop until they make a choice
{
   Console.WriteLine("Type 'I' to insert, 'R' to retrieve, 'P' to print, 'S' to save, 'U' to upload the data, or 'T' to terminate the application.");
   var input = Console.Readline();
   switch(input)
   {
      //Respond to the input. If the input should cause the application
      //to terminate, set finished = true
   }

   if(!finished)
   {
       //Indicate that the user can make more choices
   }
}

// The loop exits when finished = true, and the program ends

现在,我想将字符串值返回到$ output变量。有没有办法从c#winform app返回值。

0 个答案:

没有答案