5
我需要使用用戶確認執行異步刪除操作。類似這樣的:使用用戶確認執行異步命令
public ReactiveAsyncCommand DeleteCommand { get; protected set; }
...
DeleteCommand = new ReactiveAsyncCommand();
DeleteCommand.RegisterAsyncAction(DeleteEntity);
...
private void DeleteEntity(object obj)
{
if (MessageBox.Show("Do you really want to delete this entity?", "Confirm", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
//some delete operations
}
}
問題是MessageBox也會異步執行。 哪個是ReactiveUI中最好的模式來同步詢問用戶,然後異步執行方法?