Skip to content

DockableBase's closing design should support async #247

Answered by stevemonaco
stevemonaco asked this question in Q&A
Discussion options

You must be logged in to vote

Sorry for the non-response, but I don't know how to design an API that lends itself well to both sync and async scenarios. Not in a way that can be consumed by Dock internally anyways. I would want to override an API like:

public virtual async Task<bool> OnCloseAsync()

I ended up taking the approach from the SyncDialogExtensions before and integrating them into the VM itself at the cost of directly referencing an Avalonia bit (Dispatcher). The VM is fairly isolated and is already tied to Dock which is tied to Avalonia, so I don't mind the break in MVVM purity too much. With AvalonDock, you didn't need wrappers like this.

public partial class DockableEditorViewModel : Document
{
    [Obser…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by stevemonaco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants