mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-21 12:44:59 +03:00
Refactor_updateView to add task
This commit is contained in:
@@ -12,7 +12,7 @@ namespace ServiceLib.ViewModels
|
||||
|
||||
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
||||
|
||||
public SubEditViewModel(SubItem subItem, Func<EViewAction, object?, bool>? updateView)
|
||||
public SubEditViewModel(SubItem subItem, Func<EViewAction, object?, Task<bool>>? updateView)
|
||||
{
|
||||
_config = LazyConfig.Instance.Config;
|
||||
_noticeHandler = Locator.Current.GetService<NoticeHandler>();
|
||||
@@ -29,11 +29,11 @@ namespace ServiceLib.ViewModels
|
||||
|
||||
SaveCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
SaveSub();
|
||||
SaveSubAsync();
|
||||
});
|
||||
}
|
||||
|
||||
private void SaveSub()
|
||||
private async Task SaveSubAsync()
|
||||
{
|
||||
string remarks = SelectedSource.remarks;
|
||||
if (Utils.IsNullOrEmpty(remarks))
|
||||
@@ -45,7 +45,7 @@ namespace ServiceLib.ViewModels
|
||||
if (ConfigHandler.AddSubItem(_config, SelectedSource) == 0)
|
||||
{
|
||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
_updateView?.Invoke(EViewAction.CloseWindow, null);
|
||||
await _updateView?.Invoke(EViewAction.CloseWindow, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user