From a94ebd44f9541f03cf928d40ad11544f460e626d Mon Sep 17 00:00:00 2001 From: Kang Yu Date: Sat, 29 Jun 2024 18:22:37 -0700 Subject: [PATCH] #333, reduce waiting PW to exit period from 10 second2 to 2 seconds --- .../SystrayShell/Program.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Ninjacrab.PersistentWindows.Solution/SystrayShell/Program.cs b/Ninjacrab.PersistentWindows.Solution/SystrayShell/Program.cs index 0a93481..e1ef421 100644 --- a/Ninjacrab.PersistentWindows.Solution/SystrayShell/Program.cs +++ b/Ninjacrab.PersistentWindows.Solution/SystrayShell/Program.cs @@ -322,7 +322,7 @@ namespace PersistentWindows.SystrayShell if (relaunch) { - Restart(); + Restart(2); return; } @@ -401,14 +401,14 @@ namespace PersistentWindows.SystrayShell Log.Error("taskbar not ready, restart PersistentWindows"); } - Restart(); + Restart(10); return false; } - static void Restart() + static void Restart(int delay) { string batFile = Path.Combine(AppdataFolder, $"pw_restart.bat"); - string content = "timeout /t 10 /nobreak > NUL"; + string content = $"timeout /t {delay} /nobreak > NUL"; content += "\nstart \"\" /B \"" + Path.Combine(Application.StartupPath, Application.ProductName) + ".exe\" " + "-wait_taskbar " + Program.CmdArgs; File.WriteAllText(batFile, content); Process.Start(batFile);