diff --git a/v2rayN/ServiceLib/Services/UpdateService.cs b/v2rayN/ServiceLib/Services/UpdateService.cs index 2d086a22..428a136b 100644 --- a/v2rayN/ServiceLib/Services/UpdateService.cs +++ b/v2rayN/ServiceLib/Services/UpdateService.cs @@ -243,7 +243,7 @@ namespace ServiceLib.Services _updateFunc?.Invoke(true, string.Format(ResUI.MsgDownloadGeoFileSuccessfully, "geo")); } - public async Task RunAvailabilityCheck(Action updateFunc) + public async Task RunAvailabilityCheck() { var downloadHandle = new DownloadService(); var time = await downloadHandle.RunAvailabilityCheck(null); @@ -255,7 +255,7 @@ namespace ServiceLib.Services ip = $"({ipInfo?.country_code}) {ipInfo?.ip}"; } - updateFunc?.Invoke(false, string.Format(ResUI.TestMeOutput, time, ip)); + return string.Format(ResUI.TestMeOutput, time, ip); } #region CheckUpdate private diff --git a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs index cb49682e..efff6195 100644 --- a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs @@ -311,11 +311,11 @@ namespace ServiceLib.ViewModels { return; } - await (new UpdateService()).RunAvailabilityCheck(async (bool success, string msg) => - { - NoticeHandler.Instance.SendMessageEx(msg); - _updateView?.Invoke(EViewAction.DispatcherServerAvailability, msg); - }); + + var msg = await (new UpdateService()).RunAvailabilityCheck(); + + NoticeHandler.Instance.SendMessageEx(msg); + _updateView?.Invoke(EViewAction.DispatcherServerAvailability, msg); } public void TestServerAvailabilityResult(string msg)