2dust 2024-11-02 15:02:30 +08:00
parent c339aa349c
commit 201cfaa922
3 changed files with 10 additions and 7 deletions

View File

@ -5,6 +5,7 @@
ClearMsg,
SendMsgView,
SendSnackMsg,
RefreshProfiles
RefreshProfiles,
StopSpeedtest
}
}

View File

@ -1,7 +1,7 @@
using System.Diagnostics;
using ReactiveUI;
using System.Diagnostics;
using System.Net;
using System.Net.Sockets;
namespace ServiceLib.Services
{
public class SpeedtestService
@ -80,10 +80,12 @@ namespace ServiceLib.Services
Task.Run(RunMixedtestAsync);
break;
}
MessageBus.Current.Listen<string>(EMsgCommand.StopSpeedtest.ToString()).Subscribe(ExitLoop);
}
public void ExitLoop()
private void ExitLoop(string x)
{
if(_exitLoop) return;
_exitLoop = true;
UpdateFunc("", ResUI.SpeedtestingStop);
}

View File

@ -16,7 +16,6 @@ namespace ServiceLib.ViewModels
private List<ProfileItem> _lstProfile;
private string _serverFilter = string.Empty;
private Dictionary<string, bool> _dicHeaderSort = new();
private SpeedtestService? _speedtestHandler;
#endregion private prop
@ -686,12 +685,13 @@ namespace ServiceLib.ViewModels
}
//ClearTestResult();
_speedtestHandler = new SpeedtestService(_config, lstSelecteds, actionType, UpdateSpeedtestHandler);
_ = new SpeedtestService(_config, lstSelecteds, actionType, UpdateSpeedtestHandler);
}
public void ServerSpeedtestStop()
{
_speedtestHandler?.ExitLoop();
MessageBus.Current.SendMessage("", EMsgCommand.StopSpeedtest.ToString());
}
private async Task Export2ClientConfigAsync(bool blClipboard)