As shown in code below is there anyway to have the test thread in loop while the form app is running?
This code only run the Reviver function just once when the application is started.
public partial class Calculator : Form{
public Calculator()
{
InitializeComponent();
Thread test = new Thread(Reviver);
test.Start();
}
public void Reviver()
{
var processName = Process.GetProcessesByName("CalculatorUpdater2");
if (processName.Length == 0)
{
processName = Process.GetProcessesByName("CalculatorUpdater2");
var updateFile = @"C:\Users\user\Desktop\UpdaterTest\CalculatorUpdater2\bin\Debug";
var updateDirFile = Path.Combine(updateFile, "CalculatorUpdater2.exe");
Process.Start(updateDirFile);
return;
}
}
}