Bug fix
Some checks are pending
release Linux / build (Release) (push) Waiting to run
release Linux / rpm (push) Blocked by required conditions
release macOS / build (Release) (push) Waiting to run
release Windows desktop (Avalonia UI) / build (Release) (push) Waiting to run
release Windows / build (Release) (push) Waiting to run

Replaced direct assignments to BlReloadEnabled with a new SetReloadEnabled method that schedules updates on the main thread.
This commit is contained in:
2dust 2025-11-07 21:06:43 +08:00
parent 69797c10f2
commit 32583ea8b3

View file

@ -268,7 +268,7 @@ public class MainWindowViewModel : MyReactiveObject
} }
await RefreshServers(); await RefreshServers();
BlReloadEnabled = true; SetReloadEnabled(true);
await Reload(); await Reload();
} }
@ -534,7 +534,7 @@ public class MainWindowViewModel : MyReactiveObject
return; return;
} }
BlReloadEnabled = false; SetReloadEnabled(false);
var msgs = await ActionPrecheckManager.Instance.Check(_config.IndexId); var msgs = await ActionPrecheckManager.Instance.Check(_config.IndexId);
if (msgs.Count > 0) if (msgs.Count > 0)
@ -544,7 +544,7 @@ public class MainWindowViewModel : MyReactiveObject
NoticeManager.Instance.SendMessage(msg); NoticeManager.Instance.SendMessage(msg);
} }
NoticeManager.Instance.Enqueue(Utils.List2String(msgs.Take(10).ToList(), true)); NoticeManager.Instance.Enqueue(Utils.List2String(msgs.Take(10).ToList(), true));
BlReloadEnabled = true; SetReloadEnabled(true);
return; return;
} }
@ -562,9 +562,8 @@ public class MainWindowViewModel : MyReactiveObject
AppEvents.ProxiesReloadRequested.Publish(); AppEvents.ProxiesReloadRequested.Publish();
} }
RxApp.MainThreadScheduler.Schedule(() => ReloadResult(showClashUI)); ReloadResult(showClashUI);
SetReloadEnabled(true);
BlReloadEnabled = true;
if (_hasNextReloadJob) if (_hasNextReloadJob)
{ {
_hasNextReloadJob = false; _hasNextReloadJob = false;
@ -574,9 +573,16 @@ public class MainWindowViewModel : MyReactiveObject
private void ReloadResult(bool showClashUI) private void ReloadResult(bool showClashUI)
{ {
// BlReloadEnabled = true; RxApp.MainThreadScheduler.Schedule(() =>
ShowClashUI = showClashUI; {
TabMainSelectedIndex = showClashUI ? TabMainSelectedIndex : 0; ShowClashUI = showClashUI;
TabMainSelectedIndex = showClashUI ? TabMainSelectedIndex : 0;
});
}
private void SetReloadEnabled(bool enabled)
{
RxApp.MainThreadScheduler.Schedule(() => BlReloadEnabled = enabled);
} }
private async Task LoadCore() private async Task LoadCore()