Code optimization, function asynchrony

This commit is contained in:
2dust
2024-10-21 13:46:13 +08:00
parent a866017b4c
commit 3dd54312e7
22 changed files with 258 additions and 266 deletions
@@ -29,9 +29,13 @@ namespace ServiceLib.ViewModels
public RoutingRuleDetailsViewModel(RulesItem rulesItem, Func<EViewAction, object?, Task<bool>>? updateView)
{
_config = AppHandler.Instance.Config;
_updateView = updateView;
SaveCmd = ReactiveCommand.CreateFromTask(async () =>
{
await SaveRulesAsync();
});
if (rulesItem.id.IsNullOrEmpty())
{
rulesItem.id = Utils.GetGuid(false);
@@ -47,11 +51,6 @@ namespace ServiceLib.ViewModels
Domain = Utils.List2String(SelectedSource.domain, true);
IP = Utils.List2String(SelectedSource.ip, true);
Process = Utils.List2String(SelectedSource.process, true);
SaveCmd = ReactiveCommand.CreateFromTask(async () =>
{
await SaveRulesAsync();
});
}
private async Task SaveRulesAsync()