Code optimization, function asynchrony

This commit is contained in:
2dust
2024-10-20 11:51:05 +08:00
parent 50449df08d
commit 394b657fc9
29 changed files with 467 additions and 526 deletions
+6 -10
View File
@@ -88,7 +88,7 @@ namespace ServiceLib.Services
UpdateFunc("", ResUI.SpeedtestingStop);
}
private Task RunTcping()
private async Task RunTcping()
{
try
{
@@ -123,13 +123,11 @@ namespace ServiceLib.Services
}
finally
{
ProfileExHandler.Instance.SaveTo();
await ProfileExHandler.Instance.SaveTo();
}
return Task.CompletedTask;
}
private Task RunRealPing()
private async Task RunRealPing()
{
int pid = -1;
try
@@ -140,7 +138,7 @@ namespace ServiceLib.Services
if (pid < 0)
{
UpdateFunc("", ResUI.FailedToRunCore);
return Task.CompletedTask;
return;
}
DownloadService downloadHandle = new DownloadService();
@@ -186,10 +184,8 @@ namespace ServiceLib.Services
{
CoreHandler.Instance.CoreStopPid(pid);
}
ProfileExHandler.Instance.SaveTo();
await ProfileExHandler.Instance.SaveTo();
}
return Task.CompletedTask;
}
private async Task RunSpeedTestAsync()
@@ -321,7 +317,7 @@ namespace ServiceLib.Services
CoreHandler.Instance.CoreStopPid(pid);
}
UpdateFunc("", ResUI.SpeedtestingCompleted);
ProfileExHandler.Instance.SaveTo();
await ProfileExHandler.Instance.SaveTo();
}
private async Task RunMixedtestAsync()