C# .NET - add winform before running process - Asked By mostafa hamdy on 28-Sep-10 03:46 AM

Hello all
I have list of objects , and every object have a attributes about some setupfile, like the it's path, name ...etc
and I have looped through this list of object to create some process for every object in the list and pass the setfile path to it to be installed by that process , but I want to display some windows form  before the setupfile be runining by the process to indicates the user that some setup file will be run, the code I have created is as the following:

foreach (ProductConfiguration obj in lstProductConfig)

{

//I want to add some code to display some window form here before runing the  process and not freez the main win form



ProcessStartInfo
PSI = new ProcessStartInfo(obj.ExePath);

PSI.WindowStyle = ProcessWindowStyle.Hidden;

PSI.CreateNoWindow = false;

PSI.UseShellExecute = false;

PSI.RedirectStandardOutput = true;

PSI.CreateNoWindow = true;

System.Diagnostics.Process p = System.Diagnostics.Process.Start(PSI);

p.WaitForExit();


}
please if any body get what I mean and can help me in doing that please send me or tell me about some url may help me in doing that
Regards
Mostafa
Eddy Wissels replied to mostafa hamdy on 28-Sep-10 04:46 AM
I have done an app like this in vb net. I created several process and every process got it's own window as a child from the desktop. In that window, I displayed specific process information. What it did and how the process evolved.

It worked great, but in VB net.
To make the thread that run the form dependent on the process and not the main form I used delegates. I think you must do the same in C#. Put the creation of the process and it's window into a seperated class. And when you enumerate all your objects, create for each obj such a class, passing the obj parameters through the new methode.
It can be quite tricky. But I am sure you will succeed.

Good luck