* Fix async

* Fix async for statistics

* Try fix pac async

* Fix
This commit is contained in:
DHR60
2026-09-26 11:08:36 +08:00
committed by GitHub
parent fa1e201c76
commit 93d8174dbe
9 changed files with 153 additions and 167 deletions
@@ -30,12 +30,7 @@ public partial class ClashConnectionsViewModel : MyReactiveObject
cancelDisposable.DisposeWith(disposables);
var token = cancelDisposable.Token;
Task.Factory.StartNew(
async () => await GetClashConnectionsTask(token),
token,
TaskCreationOptions.LongRunning,
TaskScheduler.Default
);
Task.Run(() => GetClashConnectionsTask(token));
});
}
@@ -129,9 +124,9 @@ public partial class ClashConnectionsViewModel : MyReactiveObject
try
{
var numOfExecuted = 1;
while (!token.IsCancellationRequested)
using var timer = new PeriodicTimer(TimeSpan.FromSeconds(1));
while (await timer.WaitForNextTickAsync(token).ConfigureAwait(false))
{
await Task.Delay(1000, token);
numOfExecuted++;
if (!(AutoRefresh && AppManager.Instance.ShowInTaskbar &&
AppManager.Instance.IsRunningCore(ECoreType.sing_box)))
@@ -61,12 +61,7 @@ public partial class ClashProxiesViewModel : MyReactiveObject
cancelDisposable.DisposeWith(disposables);
var token = cancelDisposable.Token;
Task.Factory.StartNew(
async () => await GetClashProxiesTask(token),
token,
TaskCreationOptions.LongRunning,
TaskScheduler.Default
);
Task.Run(() => GetClashProxiesTask(token));
});
}
@@ -113,9 +108,9 @@ public partial class ClashProxiesViewModel : MyReactiveObject
try
{
var numOfExecuted = 1;
while (!token.IsCancellationRequested)
using var timer = new PeriodicTimer(TimeSpan.FromSeconds(1));
while (await timer.WaitForNextTickAsync(token).ConfigureAwait(false))
{
await Task.Delay(1000, token);
numOfExecuted++;
if (!(AutoRefresh && AppManager.Instance.ShowInTaskbar &&
AppManager.Instance.IsRunningCore(ECoreType.sing_box)))