c# 4.0 - Send/wait/receive data from CLI app through C# GUI app on VS 2010 -


i have .exe when opened looks this:

  1. enter a: (waits input a)
  2. enter b: (wait input b once entered)
  3. doing calculations..
  4. almost done..
  5. the sum of + b 10
  6. press enter exit..

i've written code based on other examples on stackoverflow (c# gui app on vs 2010):

        processstartinfo cmdstartinfo = new processstartinfo();         cmdstartinfo.filename = @"c:\mytestservice.exe";         cmdstartinfo.redirectstandardoutput = true;         cmdstartinfo.redirectstandarderror = true;         cmdstartinfo.redirectstandardinput = true;         cmdstartinfo.useshellexecute = false;         cmdstartinfo.createnowindow = false;          process cmdprocess = new process();         cmdprocess.startinfo = cmdstartinfo;         cmdprocess.errordatareceived += cmd_error;         cmdprocess.outputdatareceived += cmd_datareceived;         cmdprocess.enableraisingevents = true;         cmdprocess.start();         cmdprocess.beginoutputreadline();         cmdprocess.beginerrorreadline();         cmdprocess.standardinput.writeline(textbox1.text);         cmdprocess.standardinput.writeline(textbox2.text);          static void cmd_datareceived(object sender, datareceivedeventargs e)         {             messagebox.show("output other process: " + e.data);         }          static void cmd_error(object sender, datareceivedeventargs e)         {             messagebox.show("error other process: " + e.data);         } 

i passing , b through values entered in 2 textboxes apparently that's not working properly. how i:

  • enter , wait
  • once entered, enter b , wait
  • when console app returns "the sum of + b 10" how value 10?
  • how send enter parameter force app close?

thanks!


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -