mirror of https://github.com/2dust/v2rayN
Improved ReactiveCommand.CreateFromTask
parent
4f5362fdc4
commit
a556bf9487
|
@ -35,11 +35,11 @@ namespace ServiceLib.Models
|
||||||
string addr;
|
string addr;
|
||||||
if (arrAddr.Length > 2)
|
if (arrAddr.Length > 2)
|
||||||
{
|
{
|
||||||
addr = $"{arrAddr[0]}***{arrAddr[arrAddr.Length - 1]}";
|
addr = $"{arrAddr.First()}***{arrAddr.Last()}";
|
||||||
}
|
}
|
||||||
else if (arrAddr.Length > 1)
|
else if (arrAddr.Length > 1)
|
||||||
{
|
{
|
||||||
addr = $"***{arrAddr[arrAddr.Length - 1]}";
|
addr = $"***{arrAddr.Last()}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,19 +32,19 @@ namespace ServiceLib.ViewModels
|
||||||
}
|
}
|
||||||
CoreType = SelectedSource?.coreType?.ToString();
|
CoreType = SelectedSource?.coreType?.ToString();
|
||||||
|
|
||||||
BrowseServerCmd = ReactiveCommand.Create(() =>
|
BrowseServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
_updateView?.Invoke(EViewAction.BrowseServer, null);
|
_updateView?.Invoke(EViewAction.BrowseServer, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
EditServerCmd = ReactiveCommand.Create(() =>
|
EditServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
EditServer();
|
await EditServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
SaveServerCmd = ReactiveCommand.Create(() =>
|
SaveServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
SaveServerAsync();
|
await SaveServerAsync();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ namespace ServiceLib.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EditServer()
|
private async Task EditServer()
|
||||||
{
|
{
|
||||||
var address = SelectedSource.address;
|
var address = SelectedSource.address;
|
||||||
if (Utils.IsNullOrEmpty(address))
|
if (Utils.IsNullOrEmpty(address))
|
||||||
|
|
|
@ -34,9 +34,9 @@ namespace ServiceLib.ViewModels
|
||||||
}
|
}
|
||||||
CoreType = SelectedSource?.coreType?.ToString();
|
CoreType = SelectedSource?.coreType?.ToString();
|
||||||
|
|
||||||
SaveCmd = ReactiveCommand.Create(() =>
|
SaveCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
SaveServerAsync();
|
await SaveServerAsync();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,14 +49,14 @@ namespace ServiceLib.ViewModels
|
||||||
y => y == true)
|
y => y == true)
|
||||||
.Subscribe(c => { _config.clashUIItem.connectionsAutoRefresh = AutoRefresh; });
|
.Subscribe(c => { _config.clashUIItem.connectionsAutoRefresh = AutoRefresh; });
|
||||||
|
|
||||||
ConnectionCloseCmd = ReactiveCommand.Create(() =>
|
ConnectionCloseCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
ClashConnectionClose(false);
|
await ClashConnectionClose(false);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
|
|
||||||
ConnectionCloseAllCmd = ReactiveCommand.Create(() =>
|
ConnectionCloseAllCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
ClashConnectionClose(true);
|
await ClashConnectionClose(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
|
@ -177,7 +177,7 @@ namespace ServiceLib.ViewModels
|
||||||
_connectionItems.AddRange(lstModel);
|
_connectionItems.AddRange(lstModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClashConnectionClose(bool all)
|
public async Task ClashConnectionClose(bool all)
|
||||||
{
|
{
|
||||||
var id = string.Empty;
|
var id = string.Empty;
|
||||||
if (!all)
|
if (!all)
|
||||||
|
|
|
@ -73,22 +73,22 @@ namespace ServiceLib.ViewModels
|
||||||
y => y == true)
|
y => y == true)
|
||||||
.Subscribe(c => { _config.clashUIItem.proxiesAutoRefresh = AutoRefresh; });
|
.Subscribe(c => { _config.clashUIItem.proxiesAutoRefresh = AutoRefresh; });
|
||||||
|
|
||||||
ProxiesReloadCmd = ReactiveCommand.Create(() =>
|
ProxiesReloadCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
ProxiesReload();
|
await ProxiesReload();
|
||||||
});
|
});
|
||||||
ProxiesDelaytestCmd = ReactiveCommand.Create(() =>
|
ProxiesDelaytestCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
ProxiesDelayTest(true);
|
await ProxiesDelayTest(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
ProxiesDelaytestPartCmd = ReactiveCommand.Create(() =>
|
ProxiesDelaytestPartCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
ProxiesDelayTest(false);
|
await ProxiesDelayTest(false);
|
||||||
});
|
});
|
||||||
ProxiesSelectActivityCmd = ReactiveCommand.Create(() =>
|
ProxiesSelectActivityCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
SetActiveProxy();
|
await SetActiveProxy();
|
||||||
});
|
});
|
||||||
|
|
||||||
ProxiesReload();
|
ProxiesReload();
|
||||||
|
@ -136,13 +136,13 @@ namespace ServiceLib.ViewModels
|
||||||
NoticeHandler.Instance.SendMessageEx(msg);
|
NoticeHandler.Instance.SendMessageEx(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ProxiesReload()
|
public async Task ProxiesReload()
|
||||||
{
|
{
|
||||||
GetClashProxies(true);
|
GetClashProxies(true);
|
||||||
ProxiesDelayTest();
|
ProxiesDelayTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ProxiesDelayTest()
|
public async Task ProxiesDelayTest()
|
||||||
{
|
{
|
||||||
ProxiesDelayTest(true);
|
ProxiesDelayTest(true);
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ namespace ServiceLib.ViewModels
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetActiveProxy()
|
public async Task SetActiveProxy()
|
||||||
{
|
{
|
||||||
if (SelectedGroup == null || Utils.IsNullOrEmpty(SelectedGroup.name))
|
if (SelectedGroup == null || Utils.IsNullOrEmpty(SelectedGroup.name))
|
||||||
{
|
{
|
||||||
|
@ -380,7 +380,7 @@ namespace ServiceLib.ViewModels
|
||||||
NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess);
|
NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProxiesDelayTest(bool blAll)
|
private async Task ProxiesDelayTest(bool blAll)
|
||||||
{
|
{
|
||||||
//UpdateHandler(false, "Clash Proxies Latency Test");
|
//UpdateHandler(false, "Clash Proxies Latency Test");
|
||||||
|
|
||||||
|
|
|
@ -43,12 +43,12 @@ namespace ServiceLib.ViewModels
|
||||||
await SaveSettingAsync();
|
await SaveSettingAsync();
|
||||||
});
|
});
|
||||||
|
|
||||||
ImportDefConfig4V2rayCmd = ReactiveCommand.Create(() =>
|
ImportDefConfig4V2rayCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
normalDNS = Utils.GetEmbedText(Global.DNSV2rayNormalFileName);
|
normalDNS = Utils.GetEmbedText(Global.DNSV2rayNormalFileName);
|
||||||
});
|
});
|
||||||
|
|
||||||
ImportDefConfig4SingboxCmd = ReactiveCommand.Create(() =>
|
ImportDefConfig4SingboxCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
normalDNS2 = Utils.GetEmbedText(Global.DNSSingboxNormalFileName);
|
normalDNS2 = Utils.GetEmbedText(Global.DNSSingboxNormalFileName);
|
||||||
tunDNS2 = Utils.GetEmbedText(Global.TunSingboxDNSFileName);
|
tunDNS2 = Utils.GetEmbedText(Global.TunSingboxDNSFileName);
|
||||||
|
|
|
@ -191,49 +191,49 @@ namespace ServiceLib.ViewModels
|
||||||
.Subscribe(c => DoEnableTun(c));
|
.Subscribe(c => DoEnableTun(c));
|
||||||
|
|
||||||
//servers
|
//servers
|
||||||
AddVmessServerCmd = ReactiveCommand.Create(() =>
|
AddVmessServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
AddServerAsync(true, EConfigType.VMess);
|
await AddServerAsync(true, EConfigType.VMess);
|
||||||
});
|
});
|
||||||
AddVlessServerCmd = ReactiveCommand.Create(() =>
|
AddVlessServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
AddServerAsync(true, EConfigType.VLESS);
|
await AddServerAsync(true, EConfigType.VLESS);
|
||||||
});
|
});
|
||||||
AddShadowsocksServerCmd = ReactiveCommand.Create(() =>
|
AddShadowsocksServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
AddServerAsync(true, EConfigType.Shadowsocks);
|
await AddServerAsync(true, EConfigType.Shadowsocks);
|
||||||
});
|
});
|
||||||
AddSocksServerCmd = ReactiveCommand.Create(() =>
|
AddSocksServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
AddServerAsync(true, EConfigType.SOCKS);
|
await AddServerAsync(true, EConfigType.SOCKS);
|
||||||
});
|
});
|
||||||
AddHttpServerCmd = ReactiveCommand.Create(() =>
|
AddHttpServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
AddServerAsync(true, EConfigType.HTTP);
|
await AddServerAsync(true, EConfigType.HTTP);
|
||||||
});
|
});
|
||||||
AddTrojanServerCmd = ReactiveCommand.Create(() =>
|
AddTrojanServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
AddServerAsync(true, EConfigType.Trojan);
|
await AddServerAsync(true, EConfigType.Trojan);
|
||||||
});
|
});
|
||||||
AddHysteria2ServerCmd = ReactiveCommand.Create(() =>
|
AddHysteria2ServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
AddServerAsync(true, EConfigType.Hysteria2);
|
await AddServerAsync(true, EConfigType.Hysteria2);
|
||||||
});
|
});
|
||||||
AddTuicServerCmd = ReactiveCommand.Create(() =>
|
AddTuicServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
AddServerAsync(true, EConfigType.TUIC);
|
await AddServerAsync(true, EConfigType.TUIC);
|
||||||
});
|
});
|
||||||
AddWireguardServerCmd = ReactiveCommand.Create(() =>
|
AddWireguardServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
AddServerAsync(true, EConfigType.WireGuard);
|
await AddServerAsync(true, EConfigType.WireGuard);
|
||||||
});
|
});
|
||||||
AddCustomServerCmd = ReactiveCommand.Create(() =>
|
AddCustomServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
AddServerAsync(true, EConfigType.Custom);
|
await AddServerAsync(true, EConfigType.Custom);
|
||||||
});
|
});
|
||||||
AddServerViaClipboardCmd = ReactiveCommand.Create(() =>
|
AddServerViaClipboardCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
AddServerViaClipboardAsync(null);
|
await AddServerViaClipboardAsync(null);
|
||||||
});
|
});
|
||||||
AddServerViaScanCmd = ReactiveCommand.CreateFromTask(async () =>
|
AddServerViaScanCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
|
@ -241,40 +241,40 @@ namespace ServiceLib.ViewModels
|
||||||
});
|
});
|
||||||
|
|
||||||
//Subscription
|
//Subscription
|
||||||
SubSettingCmd = ReactiveCommand.Create(() =>
|
SubSettingCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
SubSettingAsync();
|
await SubSettingAsync();
|
||||||
});
|
});
|
||||||
|
|
||||||
SubUpdateCmd = ReactiveCommand.Create(() =>
|
SubUpdateCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
UpdateSubscriptionProcess("", false);
|
await UpdateSubscriptionProcess("", false);
|
||||||
});
|
});
|
||||||
SubUpdateViaProxyCmd = ReactiveCommand.Create(() =>
|
SubUpdateViaProxyCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
UpdateSubscriptionProcess("", true);
|
await UpdateSubscriptionProcess("", true);
|
||||||
});
|
});
|
||||||
SubGroupUpdateCmd = ReactiveCommand.Create(() =>
|
SubGroupUpdateCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
UpdateSubscriptionProcess(_config.subIndexId, false);
|
await UpdateSubscriptionProcess(_config.subIndexId, false);
|
||||||
});
|
});
|
||||||
SubGroupUpdateViaProxyCmd = ReactiveCommand.Create(() =>
|
SubGroupUpdateViaProxyCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
UpdateSubscriptionProcess(_config.subIndexId, true);
|
await UpdateSubscriptionProcess(_config.subIndexId, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
//Setting
|
//Setting
|
||||||
OptionSettingCmd = ReactiveCommand.Create(() =>
|
OptionSettingCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
OptionSettingAsync();
|
await OptionSettingAsync();
|
||||||
});
|
});
|
||||||
RoutingSettingCmd = ReactiveCommand.Create(() =>
|
RoutingSettingCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
RoutingSettingAsync();
|
await RoutingSettingAsync();
|
||||||
});
|
});
|
||||||
DNSSettingCmd = ReactiveCommand.Create(() =>
|
DNSSettingCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
DNSSettingAsync();
|
await DNSSettingAsync();
|
||||||
});
|
});
|
||||||
GlobalHotkeySettingCmd = ReactiveCommand.CreateFromTask(async () =>
|
GlobalHotkeySettingCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
|
@ -283,30 +283,22 @@ namespace ServiceLib.ViewModels
|
||||||
NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess);
|
NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RebootAsAdminCmd = ReactiveCommand.Create(() =>
|
RebootAsAdminCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
RebootAsAdmin();
|
await RebootAsAdmin();
|
||||||
});
|
});
|
||||||
ClearServerStatisticsCmd = ReactiveCommand.Create(() =>
|
ClearServerStatisticsCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
StatisticsHandler.Instance.ClearAllServerStatistics();
|
await ClearServerStatistics();
|
||||||
RefreshServers();
|
|
||||||
});
|
});
|
||||||
OpenTheFileLocationCmd = ReactiveCommand.Create(() =>
|
OpenTheFileLocationCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
if (Utils.IsWindows())
|
await OpenTheFileLocation();
|
||||||
{
|
|
||||||
Utils.ProcessStart("Explorer", $"/select,{Utils.GetConfigPath()}");
|
|
||||||
}
|
|
||||||
else if (Utils.IsLinux())
|
|
||||||
{
|
|
||||||
Utils.ProcessStart("nautilus", Utils.GetConfigPath());
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ReloadCmd = ReactiveCommand.Create(() =>
|
ReloadCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
Reload();
|
await Reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
NotifyLeftClickCmd = ReactiveCommand.CreateFromTask(async () =>
|
NotifyLeftClickCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
|
@ -315,21 +307,21 @@ namespace ServiceLib.ViewModels
|
||||||
});
|
});
|
||||||
|
|
||||||
//System proxy
|
//System proxy
|
||||||
SystemProxyClearCmd = ReactiveCommand.Create(() =>
|
SystemProxyClearCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
SetListenerType(ESysProxyType.ForcedClear);
|
await SetListenerType(ESysProxyType.ForcedClear);
|
||||||
});
|
});
|
||||||
SystemProxySetCmd = ReactiveCommand.Create(() =>
|
SystemProxySetCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
SetListenerType(ESysProxyType.ForcedChange);
|
await SetListenerType(ESysProxyType.ForcedChange);
|
||||||
});
|
});
|
||||||
SystemProxyNothingCmd = ReactiveCommand.Create(() =>
|
SystemProxyNothingCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
SetListenerType(ESysProxyType.Unchanged);
|
await SetListenerType(ESysProxyType.Unchanged);
|
||||||
});
|
});
|
||||||
SystemProxyPacCmd = ReactiveCommand.Create(() =>
|
SystemProxyPacCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
SetListenerType(ESysProxyType.Pac);
|
await SetListenerType(ESysProxyType.Pac);
|
||||||
});
|
});
|
||||||
|
|
||||||
#endregion WhenAnyValue && ReactiveCommand
|
#endregion WhenAnyValue && ReactiveCommand
|
||||||
|
@ -651,7 +643,7 @@ namespace ServiceLib.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateSubscriptionProcess(string subId, bool blProxy)
|
public async Task UpdateSubscriptionProcess(string subId, bool blProxy)
|
||||||
{
|
{
|
||||||
(new UpdateService()).UpdateSubscriptionProcess(_config, subId, blProxy, UpdateTaskHandler);
|
(new UpdateService()).UpdateSubscriptionProcess(_config, subId, blProxy, UpdateTaskHandler);
|
||||||
}
|
}
|
||||||
|
@ -691,7 +683,7 @@ namespace ServiceLib.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RebootAsAdmin()
|
private async Task RebootAsAdmin()
|
||||||
{
|
{
|
||||||
ProcessStartInfo startInfo = new()
|
ProcessStartInfo startInfo = new()
|
||||||
{
|
{
|
||||||
|
@ -709,20 +701,35 @@ namespace ServiceLib.ViewModels
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task ClearServerStatistics()
|
||||||
|
{
|
||||||
|
StatisticsHandler.Instance.ClearAllServerStatistics();
|
||||||
|
RefreshServers();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OpenTheFileLocation()
|
||||||
|
{
|
||||||
|
if (Utils.IsWindows())
|
||||||
|
{
|
||||||
|
Utils.ProcessStart("Explorer", $"/select,{Utils.GetConfigPath()}");
|
||||||
|
}
|
||||||
|
else if (Utils.IsLinux())
|
||||||
|
{
|
||||||
|
Utils.ProcessStart("nautilus", Utils.GetConfigPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Setting
|
#endregion Setting
|
||||||
|
|
||||||
#region core job
|
#region core job
|
||||||
|
|
||||||
public void Reload()
|
public async Task Reload()
|
||||||
{
|
{
|
||||||
BlReloadEnabled = false;
|
BlReloadEnabled = false;
|
||||||
|
|
||||||
LoadCore().ContinueWith(async task =>
|
await LoadCore();
|
||||||
{
|
|
||||||
await TestServerAvailability();
|
await TestServerAvailability();
|
||||||
|
|
||||||
_updateView?.Invoke(EViewAction.DispatcherReload, null);
|
_updateView?.Invoke(EViewAction.DispatcherReload, null);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReloadResult()
|
public void ReloadResult()
|
||||||
|
@ -765,7 +772,7 @@ namespace ServiceLib.ViewModels
|
||||||
|
|
||||||
#region System proxy and Routings
|
#region System proxy and Routings
|
||||||
|
|
||||||
public void SetListenerType(ESysProxyType type)
|
public async Task SetListenerType(ESysProxyType type)
|
||||||
{
|
{
|
||||||
if (_config.systemProxyItem.sysProxyType == type)
|
if (_config.systemProxyItem.sysProxyType == type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -187,9 +187,9 @@ namespace ServiceLib.ViewModels
|
||||||
|
|
||||||
InitCoreType();
|
InitCoreType();
|
||||||
|
|
||||||
SaveCmd = ReactiveCommand.Create(() =>
|
SaveCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
SaveSettingAsync();
|
await SaveSettingAsync();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,104 +137,104 @@ namespace ServiceLib.ViewModels
|
||||||
.Subscribe(c => ServerFilterChanged(c));
|
.Subscribe(c => ServerFilterChanged(c));
|
||||||
|
|
||||||
//servers delete
|
//servers delete
|
||||||
EditServerCmd = ReactiveCommand.Create(() =>
|
EditServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
EditServerAsync(EConfigType.Custom);
|
await EditServerAsync(EConfigType.Custom);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
RemoveServerCmd = ReactiveCommand.Create(() =>
|
RemoveServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
RemoveServerAsync();
|
await RemoveServerAsync();
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
RemoveDuplicateServerCmd = ReactiveCommand.Create(() =>
|
RemoveDuplicateServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
RemoveDuplicateServer();
|
await RemoveDuplicateServer();
|
||||||
});
|
});
|
||||||
CopyServerCmd = ReactiveCommand.Create(() =>
|
CopyServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
CopyServer();
|
await CopyServer();
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
SetDefaultServerCmd = ReactiveCommand.Create(() =>
|
SetDefaultServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
SetDefaultServer();
|
await SetDefaultServer();
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
ShareServerCmd = ReactiveCommand.Create(() =>
|
ShareServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
ShareServerAsync();
|
await ShareServerAsync();
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
SetDefaultMultipleServerCmd = ReactiveCommand.Create(() =>
|
SetDefaultMultipleServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
SetDefaultMultipleServer(ECoreType.sing_box);
|
await SetDefaultMultipleServer(ECoreType.sing_box);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
SetDefaultLoadBalanceServerCmd = ReactiveCommand.Create(() =>
|
SetDefaultLoadBalanceServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
SetDefaultMultipleServer(ECoreType.Xray);
|
await SetDefaultMultipleServer(ECoreType.Xray);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
|
|
||||||
//servers move
|
//servers move
|
||||||
MoveTopCmd = ReactiveCommand.Create(() =>
|
MoveTopCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
MoveServer(EMove.Top);
|
await MoveServer(EMove.Top);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
MoveUpCmd = ReactiveCommand.Create(() =>
|
MoveUpCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
MoveServer(EMove.Up);
|
await MoveServer(EMove.Up);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
MoveDownCmd = ReactiveCommand.Create(() =>
|
MoveDownCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
MoveServer(EMove.Down);
|
await MoveServer(EMove.Down);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
MoveBottomCmd = ReactiveCommand.Create(() =>
|
MoveBottomCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
MoveServer(EMove.Bottom);
|
await MoveServer(EMove.Bottom);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
|
|
||||||
//servers ping
|
//servers ping
|
||||||
MixedTestServerCmd = ReactiveCommand.Create(() =>
|
MixedTestServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
ServerSpeedtest(ESpeedActionType.Mixedtest);
|
await ServerSpeedtest(ESpeedActionType.Mixedtest);
|
||||||
});
|
});
|
||||||
TcpingServerCmd = ReactiveCommand.Create(() =>
|
TcpingServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
ServerSpeedtest(ESpeedActionType.Tcping);
|
await ServerSpeedtest(ESpeedActionType.Tcping);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
RealPingServerCmd = ReactiveCommand.Create(() =>
|
RealPingServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
ServerSpeedtest(ESpeedActionType.Realping);
|
await ServerSpeedtest(ESpeedActionType.Realping);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
SpeedServerCmd = ReactiveCommand.Create(() =>
|
SpeedServerCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
ServerSpeedtest(ESpeedActionType.Speedtest);
|
await ServerSpeedtest(ESpeedActionType.Speedtest);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
SortServerResultCmd = ReactiveCommand.Create(() =>
|
SortServerResultCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
SortServer(EServerColName.delayVal.ToString());
|
await SortServer(EServerColName.delayVal.ToString());
|
||||||
});
|
});
|
||||||
//servers export
|
//servers export
|
||||||
Export2ClientConfigCmd = ReactiveCommand.Create(() =>
|
Export2ClientConfigCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
Export2ClientConfigAsync(false);
|
await Export2ClientConfigAsync(false);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
Export2ClientConfigClipboardCmd = ReactiveCommand.Create(() =>
|
Export2ClientConfigClipboardCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
Export2ClientConfigAsync(true);
|
await Export2ClientConfigAsync(true);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
Export2ShareUrlCmd = ReactiveCommand.Create(() =>
|
Export2ShareUrlCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
Export2ShareUrlAsync(false);
|
await Export2ShareUrlAsync(false);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
Export2ShareUrlBase64Cmd = ReactiveCommand.Create(() =>
|
Export2ShareUrlBase64Cmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
Export2ShareUrlAsync(true);
|
await Export2ShareUrlAsync(true);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
|
|
||||||
//Subscription
|
//Subscription
|
||||||
AddSubCmd = ReactiveCommand.Create(() =>
|
AddSubCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
EditSubAsync(true);
|
await EditSubAsync(true);
|
||||||
});
|
});
|
||||||
EditSubCmd = ReactiveCommand.Create(() =>
|
EditSubCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
EditSubAsync(false);
|
await EditSubAsync(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
#endregion WhenAnyValue && ReactiveCommand
|
#endregion WhenAnyValue && ReactiveCommand
|
||||||
|
@ -475,7 +475,7 @@ namespace ServiceLib.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveDuplicateServer()
|
private async Task RemoveDuplicateServer()
|
||||||
{
|
{
|
||||||
var tuple = ConfigHandler.DedupServerList(_config, _config.subIndexId);
|
var tuple = ConfigHandler.DedupServerList(_config, _config.subIndexId);
|
||||||
RefreshServers();
|
RefreshServers();
|
||||||
|
@ -483,7 +483,7 @@ namespace ServiceLib.ViewModels
|
||||||
NoticeHandler.Instance.Enqueue(string.Format(ResUI.RemoveDuplicateServerResult, tuple.Item1, tuple.Item2));
|
NoticeHandler.Instance.Enqueue(string.Format(ResUI.RemoveDuplicateServerResult, tuple.Item1, tuple.Item2));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CopyServer()
|
private async Task CopyServer()
|
||||||
{
|
{
|
||||||
if (GetProfileItems(out List<ProfileItem> lstSelecteds, false) < 0)
|
if (GetProfileItems(out List<ProfileItem> lstSelecteds, false) < 0)
|
||||||
{
|
{
|
||||||
|
@ -496,7 +496,7 @@ namespace ServiceLib.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetDefaultServer()
|
public async Task SetDefaultServer()
|
||||||
{
|
{
|
||||||
if (Utils.IsNullOrEmpty(SelectedProfile?.indexId))
|
if (Utils.IsNullOrEmpty(SelectedProfile?.indexId))
|
||||||
{
|
{
|
||||||
|
@ -505,7 +505,7 @@ namespace ServiceLib.ViewModels
|
||||||
SetDefaultServer(SelectedProfile.indexId);
|
SetDefaultServer(SelectedProfile.indexId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetDefaultServer(string indexId)
|
private async Task SetDefaultServer(string indexId)
|
||||||
{
|
{
|
||||||
if (Utils.IsNullOrEmpty(indexId))
|
if (Utils.IsNullOrEmpty(indexId))
|
||||||
{
|
{
|
||||||
|
@ -563,7 +563,7 @@ namespace ServiceLib.ViewModels
|
||||||
await _updateView?.Invoke(EViewAction.ShareServer, url);
|
await _updateView?.Invoke(EViewAction.ShareServer, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetDefaultMultipleServer(ECoreType coreType)
|
private async Task SetDefaultMultipleServer(ECoreType coreType)
|
||||||
{
|
{
|
||||||
if (GetProfileItems(out List<ProfileItem> lstSelecteds, true) < 0)
|
if (GetProfileItems(out List<ProfileItem> lstSelecteds, true) < 0)
|
||||||
{
|
{
|
||||||
|
@ -586,7 +586,7 @@ namespace ServiceLib.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SortServer(string colName)
|
public async Task SortServer(string colName)
|
||||||
{
|
{
|
||||||
if (Utils.IsNullOrEmpty(colName))
|
if (Utils.IsNullOrEmpty(colName))
|
||||||
{
|
{
|
||||||
|
@ -624,7 +624,7 @@ namespace ServiceLib.ViewModels
|
||||||
//Reload();
|
//Reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MoveServer(EMove eMove)
|
public async Task MoveServer(EMove eMove)
|
||||||
{
|
{
|
||||||
var item = _lstProfile.FirstOrDefault(t => t.indexId == SelectedProfile.indexId);
|
var item = _lstProfile.FirstOrDefault(t => t.indexId == SelectedProfile.indexId);
|
||||||
if (item is null)
|
if (item is null)
|
||||||
|
@ -656,7 +656,7 @@ namespace ServiceLib.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ServerSpeedtest(ESpeedActionType actionType)
|
public async Task ServerSpeedtest(ESpeedActionType actionType)
|
||||||
{
|
{
|
||||||
if (actionType == ESpeedActionType.Mixedtest)
|
if (actionType == ESpeedActionType.Mixedtest)
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,9 +48,9 @@ namespace ServiceLib.ViewModels
|
||||||
IP = Utils.List2String(SelectedSource.ip, true);
|
IP = Utils.List2String(SelectedSource.ip, true);
|
||||||
Process = Utils.List2String(SelectedSource.process, true);
|
Process = Utils.List2String(SelectedSource.process, true);
|
||||||
|
|
||||||
SaveCmd = ReactiveCommand.Create(() =>
|
SaveCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
SaveRulesAsync();
|
await SaveRulesAsync();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,52 +57,52 @@ namespace ServiceLib.ViewModels
|
||||||
x => x.SelectedSource,
|
x => x.SelectedSource,
|
||||||
selectedSource => selectedSource != null && !selectedSource.outboundTag.IsNullOrEmpty());
|
selectedSource => selectedSource != null && !selectedSource.outboundTag.IsNullOrEmpty());
|
||||||
|
|
||||||
RuleAddCmd = ReactiveCommand.Create(() =>
|
RuleAddCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
RuleEditAsync(true);
|
await RuleEditAsync(true);
|
||||||
});
|
});
|
||||||
ImportRulesFromFileCmd = ReactiveCommand.CreateFromTask(async () =>
|
ImportRulesFromFileCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
await _updateView?.Invoke(EViewAction.ImportRulesFromFile, null);
|
await _updateView?.Invoke(EViewAction.ImportRulesFromFile, null);
|
||||||
});
|
});
|
||||||
ImportRulesFromClipboardCmd = ReactiveCommand.Create(() =>
|
ImportRulesFromClipboardCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
ImportRulesFromClipboardAsync(null);
|
await ImportRulesFromClipboardAsync(null);
|
||||||
});
|
});
|
||||||
ImportRulesFromUrlCmd = ReactiveCommand.Create(() =>
|
ImportRulesFromUrlCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
ImportRulesFromUrl();
|
await ImportRulesFromUrl();
|
||||||
});
|
});
|
||||||
|
|
||||||
RuleRemoveCmd = ReactiveCommand.Create(() =>
|
RuleRemoveCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
RuleRemoveAsync();
|
await RuleRemoveAsync();
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
RuleExportSelectedCmd = ReactiveCommand.Create(() =>
|
RuleExportSelectedCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
RuleExportSelectedAsync();
|
await RuleExportSelectedAsync();
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
|
|
||||||
MoveTopCmd = ReactiveCommand.Create(() =>
|
MoveTopCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
MoveRule(EMove.Top);
|
await MoveRule(EMove.Top);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
MoveUpCmd = ReactiveCommand.Create(() =>
|
MoveUpCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
MoveRule(EMove.Up);
|
await MoveRule(EMove.Up);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
MoveDownCmd = ReactiveCommand.Create(() =>
|
MoveDownCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
MoveRule(EMove.Down);
|
await MoveRule(EMove.Down);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
MoveBottomCmd = ReactiveCommand.Create(() =>
|
MoveBottomCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
MoveRule(EMove.Bottom);
|
await MoveRule(EMove.Bottom);
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
|
|
||||||
SaveCmd = ReactiveCommand.Create(() =>
|
SaveCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
SaveRoutingAsync();
|
await SaveRoutingAsync();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ namespace ServiceLib.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MoveRule(EMove eMove)
|
public async Task MoveRule(EMove eMove)
|
||||||
{
|
{
|
||||||
if (SelectedSource is null || SelectedSource.outboundTag.IsNullOrEmpty())
|
if (SelectedSource is null || SelectedSource.outboundTag.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
|
@ -285,7 +285,7 @@ namespace ServiceLib.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void ImportRulesFromUrl()
|
private async Task ImportRulesFromUrl()
|
||||||
{
|
{
|
||||||
var url = SelectedRouting.url;
|
var url = SelectedRouting.url;
|
||||||
if (Utils.IsNullOrEmpty(url))
|
if (Utils.IsNullOrEmpty(url))
|
||||||
|
|
|
@ -90,31 +90,31 @@ namespace ServiceLib.ViewModels
|
||||||
x => x.enableRoutingAdvanced)
|
x => x.enableRoutingAdvanced)
|
||||||
.Subscribe(c => enableRoutingBasic = !enableRoutingAdvanced);
|
.Subscribe(c => enableRoutingBasic = !enableRoutingAdvanced);
|
||||||
|
|
||||||
RoutingBasicImportRulesCmd = ReactiveCommand.Create(() =>
|
RoutingBasicImportRulesCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
RoutingBasicImportRules();
|
await RoutingBasicImportRules();
|
||||||
});
|
});
|
||||||
|
|
||||||
RoutingAdvancedAddCmd = ReactiveCommand.Create(() =>
|
RoutingAdvancedAddCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
RoutingAdvancedEditAsync(true);
|
await RoutingAdvancedEditAsync(true);
|
||||||
});
|
});
|
||||||
RoutingAdvancedRemoveCmd = ReactiveCommand.Create(() =>
|
RoutingAdvancedRemoveCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
RoutingAdvancedRemoveAsync();
|
await RoutingAdvancedRemoveAsync();
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
RoutingAdvancedSetDefaultCmd = ReactiveCommand.Create(() =>
|
RoutingAdvancedSetDefaultCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
RoutingAdvancedSetDefault();
|
await RoutingAdvancedSetDefault();
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
RoutingAdvancedImportRulesCmd = ReactiveCommand.Create(() =>
|
RoutingAdvancedImportRulesCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
RoutingAdvancedImportRules();
|
await RoutingAdvancedImportRules();
|
||||||
});
|
});
|
||||||
|
|
||||||
SaveCmd = ReactiveCommand.Create(() =>
|
SaveCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
SaveRoutingAsync();
|
await SaveRoutingAsync();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ namespace ServiceLib.ViewModels
|
||||||
|
|
||||||
#endregion Refresh Save
|
#endregion Refresh Save
|
||||||
|
|
||||||
private void RoutingBasicImportRules()
|
private async Task RoutingBasicImportRules()
|
||||||
{
|
{
|
||||||
//Extra to bypass the mainland
|
//Extra to bypass the mainland
|
||||||
ProxyDomain = "geosite:google";
|
ProxyDomain = "geosite:google";
|
||||||
|
@ -268,7 +268,7 @@ namespace ServiceLib.ViewModels
|
||||||
IsModified = true;
|
IsModified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RoutingAdvancedSetDefault()
|
public async Task RoutingAdvancedSetDefault()
|
||||||
{
|
{
|
||||||
var item = AppHandler.Instance.GetRoutingItem(SelectedSource?.id);
|
var item = AppHandler.Instance.GetRoutingItem(SelectedSource?.id);
|
||||||
if (item is null)
|
if (item is null)
|
||||||
|
@ -284,7 +284,7 @@ namespace ServiceLib.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RoutingAdvancedImportRules()
|
private async Task RoutingAdvancedImportRules()
|
||||||
{
|
{
|
||||||
if (ConfigHandler.InitBuiltinRouting(_config, true) == 0)
|
if (ConfigHandler.InitBuiltinRouting(_config, true) == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,9 +26,9 @@ namespace ServiceLib.ViewModels
|
||||||
SelectedSource = JsonUtils.DeepCopy(subItem);
|
SelectedSource = JsonUtils.DeepCopy(subItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveCmd = ReactiveCommand.Create(() =>
|
SaveCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
SaveSubAsync();
|
await SaveSubAsync();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,13 +36,13 @@ namespace ServiceLib.ViewModels
|
||||||
x => x.SelectedSource,
|
x => x.SelectedSource,
|
||||||
selectedSource => selectedSource != null && !selectedSource.id.IsNullOrEmpty());
|
selectedSource => selectedSource != null && !selectedSource.id.IsNullOrEmpty());
|
||||||
|
|
||||||
SubAddCmd = ReactiveCommand.Create(() =>
|
SubAddCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
EditSubAsync(true);
|
await EditSubAsync(true);
|
||||||
});
|
});
|
||||||
SubDeleteCmd = ReactiveCommand.Create(() =>
|
SubDeleteCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
DeleteSubAsync();
|
await DeleteSubAsync();
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
SubEditCmd = ReactiveCommand.CreateFromTask(async () =>
|
SubEditCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue