Im trying to monitor a process until the process ends but the program keeps freezing during the while loop and wont keep running. Heres what I have so far:
Any ideas how I can get this working?
Code:
private void ProcessCheck()
{
bool done = false;
while (!done)
{
System.Diagnostics.Process[] myProcesses;
myProcesses =
System.Diagnostics.Process.GetProcessesByName("gsengine");
if (myProcesses != null)
{
tabPage2.Enabled = false;
tabPage3.Enabled = false;
tabPage4.Enabled = false;
Start.Visible = false;
stop.Visible = true;
toolStripStatusLabel1.Text = "CORE RUNNING!";
}
if (myProcesses == null)
{
tabPage2.Enabled = true;
tabPage3.Enabled = true;
tabPage4.Enabled = true;
Start.Visible = true;
stop.Visible = false;
toolStripStatusLabel1.Text = "CORE STOPPED FOR SOME REASON!";
done = true;
}
}
}
Comment