Azodious
Azodious

Reputation: 13872

Invoke UI application in a thread

I've 2 exe (A, B) and one dll (C).

A is an exe that user invokes from commandline with argument -ui or -file_path.

if -ui is passed: B is used to show UI. if -file_path is passed, C is used for further functionality.

if -ui is passed, i use following code (in Main method):

 System.Threading.Thread a = new System.Threading.Thread(yah);
 a.Start();

 static void yah()
 {
     SyngoViaInstallerUI.Program.Main();
 }

but it blocks the command line from where exe A was invoked. is it possible to unblock the cmdLine or i should to create a new process for -ui argument?

Thanks.

Upvotes: 1

Views: 213

Answers (2)

Azodious
Azodious

Reputation: 13872

Following code works, but is this correct way?

System.Diagnostics.Process pr = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
psi.FileName = @"file_path";
pr.StartInfo = psi;
pr.Start();

Thanks.

Upvotes: 0

Mubashir Khan
Mubashir Khan

Reputation: 1494

you have to create seperate process for B in order to release the process A and finish gracefully.

Upvotes: 3

Related Questions