mirror of
https://github.com/bolucat/Archive.git
synced 2026-04-23 00:17:16 +08:00
Update On Fri Aug 23 20:31:50 CEST 2024
This commit is contained in:
@@ -23,7 +23,7 @@ namespace ServiceLib.ViewModels
|
||||
public ReactiveCommand<Unit, Unit> SubShareCmd { get; }
|
||||
public bool IsModified { get; set; }
|
||||
|
||||
public SubSettingViewModel(Func<EViewAction, object?, bool>? updateView)
|
||||
public SubSettingViewModel(Func<EViewAction, object?, Task<bool>>? updateView)
|
||||
{
|
||||
_config = LazyConfig.Instance.Config;
|
||||
_noticeHandler = Locator.Current.GetService<NoticeHandler>();
|
||||
@@ -39,19 +39,19 @@ namespace ServiceLib.ViewModels
|
||||
|
||||
SubAddCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
EditSub(true);
|
||||
EditSubAsync(true);
|
||||
});
|
||||
SubDeleteCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
DeleteSub();
|
||||
DeleteSubAsync();
|
||||
}, canEditRemove);
|
||||
SubEditCmd = ReactiveCommand.Create(() =>
|
||||
SubEditCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
EditSub(false);
|
||||
await EditSubAsync(false);
|
||||
}, canEditRemove);
|
||||
SubShareCmd = ReactiveCommand.Create(() =>
|
||||
SubShareCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
_updateView?.Invoke(EViewAction.ShareSub, SelectedSource?.url);
|
||||
await _updateView?.Invoke(EViewAction.ShareSub, SelectedSource?.url);
|
||||
}, canEditRemove);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace ServiceLib.ViewModels
|
||||
_subItems.AddRange(LazyConfig.Instance.SubItems().OrderBy(t => t.sort));
|
||||
}
|
||||
|
||||
public void EditSub(bool blNew)
|
||||
public async Task EditSubAsync(bool blNew)
|
||||
{
|
||||
SubItem item;
|
||||
if (blNew)
|
||||
@@ -76,16 +76,16 @@ namespace ServiceLib.ViewModels
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (_updateView?.Invoke(EViewAction.SubEditWindow, item) == true)
|
||||
if (await _updateView?.Invoke(EViewAction.SubEditWindow, item) == true)
|
||||
{
|
||||
RefreshSubItems();
|
||||
IsModified = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteSub()
|
||||
private async Task DeleteSubAsync()
|
||||
{
|
||||
if (_updateView?.Invoke(EViewAction.ShowYesNo, null) == false)
|
||||
if (await _updateView?.Invoke(EViewAction.ShowYesNo, null) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user