mirror of
https://github.com/2dust/v2rayN.git
synced 2026-08-25 08:32:05 +03:00
@@ -85,8 +85,6 @@ public partial class MainWindowViewModel : MyReactiveObject
|
||||
|
||||
#endregion Menu
|
||||
|
||||
private readonly SynchronizationContext _uiContext = SynchronizationContext.Current;
|
||||
|
||||
#region Init
|
||||
|
||||
public MainWindowViewModel()
|
||||
@@ -302,7 +300,7 @@ public partial class MainWindowViewModel : MyReactiveObject
|
||||
.ObserveOn(RxSchedulers.MainThreadScheduler)
|
||||
.Subscribe(async blShow =>
|
||||
{
|
||||
await ShowHideWindowInteraction.Handle(blShow);
|
||||
await ShowHideWindowInteraction.HandleSafe(blShow);
|
||||
});
|
||||
|
||||
StatusBarViewModel.SetDefaultServerRequested
|
||||
@@ -413,14 +411,25 @@ public partial class MainWindowViewModel : MyReactiveObject
|
||||
private async Task RefreshServersDispatcherAsync()
|
||||
{
|
||||
//await Observable.Start(async () => await RefreshServers(), RxSchedulers.MainThreadScheduler);
|
||||
_uiContext?.Post(_ => _ = RefreshServers(), null);
|
||||
await Signal.FromAsync(async () =>
|
||||
{
|
||||
await RefreshServers();
|
||||
return RxVoid.Default;
|
||||
})
|
||||
.SubscribeOn(RxSchedulers.MainThreadScheduler)
|
||||
.ToTask();
|
||||
}
|
||||
|
||||
private async Task RefreshSubscriptions()
|
||||
{
|
||||
//await Observable.Start(async () => await ProfilesViewModel.RefreshSubscriptions(), RxSchedulers.MainThreadScheduler);
|
||||
|
||||
_uiContext?.Post(_ => _ = ProfilesViewModel.RefreshSubscriptions(), null);
|
||||
await Signal.FromAsync(async () =>
|
||||
{
|
||||
await ProfilesViewModel.RefreshSubscriptions();
|
||||
return RxVoid.Default;
|
||||
})
|
||||
.SubscribeOn(RxSchedulers.MainThreadScheduler)
|
||||
.ToTask();
|
||||
}
|
||||
|
||||
#endregion Servers && Groups
|
||||
@@ -467,7 +476,7 @@ public partial class MainWindowViewModel : MyReactiveObject
|
||||
var stringData = clipboardData;
|
||||
if (clipboardData == null)
|
||||
{
|
||||
var result = await ReadTextFromClipboardInteraction.Handle(RxVoid.Default);
|
||||
var result = await ReadTextFromClipboardInteraction.HandleSafe(RxVoid.Default);
|
||||
if (result.IsNullOrEmpty())
|
||||
{
|
||||
NoticeManager.Instance.Enqueue(ResUI.OperationFailed);
|
||||
@@ -490,7 +499,7 @@ public partial class MainWindowViewModel : MyReactiveObject
|
||||
|
||||
public async Task AddServerViaScanAsync()
|
||||
{
|
||||
var result = await ScanScreenInteraction.Handle(RxVoid.Default);
|
||||
var result = await ScanScreenInteraction.HandleSafe(RxVoid.Default);
|
||||
await ScanScreenResult(result);
|
||||
}
|
||||
|
||||
@@ -502,7 +511,7 @@ public partial class MainWindowViewModel : MyReactiveObject
|
||||
|
||||
public async Task AddServerViaImageAsync()
|
||||
{
|
||||
var imageFileName = await BrowseImageFileInteraction.Handle(RxVoid.Default);
|
||||
var imageFileName = await BrowseImageFileInteraction.HandleSafe(RxVoid.Default);
|
||||
await AddScanResultAsync(imageFileName);
|
||||
}
|
||||
|
||||
@@ -691,10 +700,12 @@ public partial class MainWindowViewModel : MyReactiveObject
|
||||
//{
|
||||
// await ClashProxiesViewModel.ProxiesReload();
|
||||
//}, RxSchedulers.MainThreadScheduler);
|
||||
RxSchedulers.MainThreadScheduler.Schedule(async () =>
|
||||
{
|
||||
await ClashProxiesViewModel.ProxiesReload();
|
||||
});
|
||||
await Signal.FromAsync(async () =>
|
||||
{
|
||||
await ClashProxiesViewModel.ProxiesReload();
|
||||
return RxVoid.Default;
|
||||
}).SubscribeOn(RxSchedulers.MainThreadScheduler)
|
||||
.ToTask();
|
||||
}
|
||||
|
||||
ReloadResult(showClashUI);
|
||||
|
||||
Reference in New Issue
Block a user