Teď jsem to vylepšil ještě takhle:
if (Timer.Enabled == true) // Pokud Timer skutečně běží
Timer.Stop(); // Zastav jej a pokračuj... :
Console.WriteLine("Prohledavam databazi...");
ProcessStartInfo start = new ProcessStartInfo();
// Enter in the command line arguments, everything you would enter after the executable name itself
start.Arguments = "-f d:\\Programy\\EasyPHP-Devserver-17\\eds-www\\telnet\\skript.php";
// Enter the executable to run, including the complete path
start.FileName = "d:\\Programy\\EasyPHP-Devserver-17\\eds-binaries\\php\\php5630vc11x86x190305170114\\php.exe";
// Do you want to show a console window?
start.WindowStyle = ProcessWindowStyle.Hidden;
start.CreateNoWindow = true;
int exitCode;
// Run the external process & wait for it to finish
using (Process proc = Process.Start(start))
{
proc.WaitForExit(); // čekej, pozastav vlákno, dokud se spuštěný proces neukončí !
// Retrieve the app's exit code
exitCode = proc.ExitCode;
}
Console.WriteLine("Prohledavani dokonceno.");
if( Timer.Enabled == false) // Pokud je Timer vypnutý, zapni jej opět
Timer.Start();