项目重启优化。
This commit is contained in:
lincube
2026-03-09 17:54:49 +08:00
parent 8bb6b01236
commit e97db00999
12 changed files with 348 additions and 31 deletions

View File

@@ -101,42 +101,12 @@ public partial class App : Application
return;
}
if (TryStartCurrentProcess())
if (AppRestartService.TryRestartCurrentProcess())
{
desktop.Shutdown();
}
}
private static bool TryStartCurrentProcess()
{
try
{
var args = Environment.GetCommandLineArgs();
if (args.Length == 0 || string.IsNullOrWhiteSpace(args[0]))
{
return false;
}
var startInfo = new ProcessStartInfo
{
FileName = args[0],
UseShellExecute = false
};
for (var i = 1; i < args.Length; i++)
{
startInfo.ArgumentList.Add(args[i]);
}
Process.Start(startInfo);
return true;
}
catch
{
return false;
}
}
private void DisableAvaloniaDataAnnotationValidation()
{
// Get an array of plugins to remove