c# - Continue the application even if a thirdparty application fails -


I have the progestest express file name Projtest.exe and I command line. I was successful in writing the application, but my issue is that for some unknown reasons Projtest.exe stops working and throws the error window. My application is roaming at this point. What I want to do if Projtest continues my application Exe throws an error window. how can I do this. Part of my code is given below.

  try {var pro = new process {StartInfo = {arguments = string.format ("Projtest. Exe {0} {1}", arg1, arg2)}}; Pro.Start (); Pro.WaitForExit (); Var exit = pro.ExitCode; } Hold (Exception Pre) {Console.WriteLine (ex.ToString ()); What can you do regular checks that 'pro' ten times?      

You can do it with just a timer or you can make a thread to it. Also, it is being investigated to get out of here so that you do not block your application. Here is an example with a timer.

  Fixed timer app check = new timer (); Static Process Pro; Static zero main (string [] args) {appCheck.Interval = (10000); // Set timer interval in MS appCheck.AutoReset = true; AppCheck.Elapsed + = New ElapsedEventHandler (appCheck_Tick); {Pro = New process {StartInfo = {Arguments = string.Format (@ "Projtest.exe"), try filename = string.format (@ "Projtest.exe")}}; Pro.Start (); // Checks your program app. start over (); // Starting a timer to keep a watch on your program (true) // It just keeps your console window open if you wait, your application will be blocked and the timer will not fire {} // Pro.WaitForExit (); } Hold (Exception Pre) {Console.WriteLine (ex.ToString ()); }} Fixed Zero App Check Check (Object Sender, Event Argus E) {If (Prof. Haasaxit) {If (Prof. Reporting == Incorrect) {appCheck.Stop (); Turn off // timer so that you can not keep the message console. WriteLine ("no answer"); }} And {appCheck.Stop (); Turn off // timer so that you can not keep the message console. WrightLine ("exited"); }}  

Comments