private void waitForProcessAndActivate(Process process)
{
try
{
process.WaitForInputIdle(6000);
int ii = 0;
while (true)
{
IntPtr handle = process.MainWindowHandle;
if (handle != IntPtr.Zero)
{
activateWindow(handle);
break;
}
Thread.Sleep(500);
ii++;
if (ii > 10)
{
break;
}
}
}
catch (Exception ex)
{
Log.Exception(ex);
}
}