C# - Wait for process start
So what I am attempting to do is start explorer from my program then pop
my application back in front of explorer or just start explorer behind my
application...
Currently I have explorer starting then I have actions to bring my
application to the front but explorer can take a few seconds to start and
that messes up my whole chain of events.
This is what I am currently doing:
Process process = new Process();
process.StartInfo.FileName = environmentVariable + "\\explorer.exe";
process.StartInfo.Arguments =
!string.IsNullOrEmpty(this.uxMainFolder.Text) ? this.uxMainFolder.Text +
"\\" + path2 : Path.Combine("R:\\Project", path2);
try
{
process.Start();
this.WindowState = FormWindowState.Minimized;
this.Show();
this.WindowState = FormWindowState.Normal;
}
finally
{
process.Dispose();
}
Any light you can shed on this problem would be much appreciated.
No comments:
Post a Comment