mirror of
https://github.com/kangyu-california/PersistentWindows.git
synced 2025-05-11 04:55:39 +02:00
#333, reduce waiting PW to exit period from 10 second2 to 2 seconds
This commit is contained in:
parent
aca54b9ec1
commit
a94ebd44f9
1 changed files with 4 additions and 4 deletions
|
@ -322,7 +322,7 @@ namespace PersistentWindows.SystrayShell
|
||||||
|
|
||||||
if (relaunch)
|
if (relaunch)
|
||||||
{
|
{
|
||||||
Restart();
|
Restart(2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,14 +401,14 @@ namespace PersistentWindows.SystrayShell
|
||||||
Log.Error("taskbar not ready, restart PersistentWindows");
|
Log.Error("taskbar not ready, restart PersistentWindows");
|
||||||
}
|
}
|
||||||
|
|
||||||
Restart();
|
Restart(10);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Restart()
|
static void Restart(int delay)
|
||||||
{
|
{
|
||||||
string batFile = Path.Combine(AppdataFolder, $"pw_restart.bat");
|
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;
|
content += "\nstart \"\" /B \"" + Path.Combine(Application.StartupPath, Application.ProductName) + ".exe\" " + "-wait_taskbar " + Program.CmdArgs;
|
||||||
File.WriteAllText(batFile, content);
|
File.WriteAllText(batFile, content);
|
||||||
Process.Start(batFile);
|
Process.Start(batFile);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue