Console and Windows Forms in C #

OK. I am creating an application with a plug-in architecture, and the application will be able to work without a graphical interface, in other words, the graphical interface is really optional ... and if the user decides to use the graphical interface, the console is simply hidden.

I can create a form in the console by calling one of the plugin methods, but as soon as the window is created, the console program will wait until the window is closed ... there is a way to create the form so that the console does not need to wait, it should continue to work on it own material and just notify gui with some information?

+4
source share
2 answers

Why don't you save the Windows Forms application as a separate executable and call process.start ()?

for instance

Process.Start("c:\yourwindowsformsapplication.exe"); 

You can exit the console application or continue working in the console application after running windowsapplication.exe.

And use remote access to communicate between both applications.

or....

Create a new thread and call form.show () on the new thread

Example:

 Form frm=new form(); Thread th=new Thread(frm.show); th.start(); 
+2
source

Do you create and then show the form with ShowDialog ()? If so, why is the console application waiting for the form to close. Try showing the form using Show () instead - Show () is a non-blocking call that will return program execution to the next line.

+1
source

All Articles