mirror of
https://github.com/2dust/v2rayN.git
synced 2026-09-22 22:38:10 +03:00
@@ -84,6 +84,8 @@ public partial class MainWindowViewModel : MyReactiveObject
|
|||||||
|
|
||||||
#endregion Menu
|
#endregion Menu
|
||||||
|
|
||||||
|
private readonly SynchronizationContext _uiContext = SynchronizationContext.Current;
|
||||||
|
|
||||||
#region Init
|
#region Init
|
||||||
|
|
||||||
public MainWindowViewModel()
|
public MainWindowViewModel()
|
||||||
@@ -406,33 +408,14 @@ public partial class MainWindowViewModel : MyReactiveObject
|
|||||||
private async Task RefreshServersDispatcherAsync()
|
private async Task RefreshServersDispatcherAsync()
|
||||||
{
|
{
|
||||||
//await Observable.Start(async () => await RefreshServers(), RxSchedulers.MainThreadScheduler);
|
//await Observable.Start(async () => await RefreshServers(), RxSchedulers.MainThreadScheduler);
|
||||||
|
_uiContext?.Post(_ => _ = RefreshServers(), null);
|
||||||
var uiContext = SynchronizationContext.Current;
|
|
||||||
if (uiContext != null)
|
|
||||||
{
|
|
||||||
var uiSequencer = new SynchronizationContextSequencer(uiContext);
|
|
||||||
uiSequencer.Schedule(() => _ = RefreshServers());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await RefreshServers();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task RefreshSubscriptions()
|
private async Task RefreshSubscriptions()
|
||||||
{
|
{
|
||||||
//await Observable.Start(async () => await ProfilesViewModel.RefreshSubscriptions(), RxSchedulers.MainThreadScheduler);
|
//await Observable.Start(async () => await ProfilesViewModel.RefreshSubscriptions(), RxSchedulers.MainThreadScheduler);
|
||||||
|
|
||||||
var uiContext = SynchronizationContext.Current;
|
_uiContext?.Post(_ => _ = ProfilesViewModel.RefreshSubscriptions(), null);
|
||||||
if (uiContext != null)
|
|
||||||
{
|
|
||||||
var uiSequencer = new SynchronizationContextSequencer(uiContext);
|
|
||||||
uiSequencer.Schedule(() => _ = ProfilesViewModel.RefreshSubscriptions());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await ProfilesViewModel.RefreshSubscriptions();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Servers && Groups
|
#endregion Servers && Groups
|
||||||
|
|||||||
Reference in New Issue
Block a user