Skip to content

Recommended pattern after Activated changed to AsyncEventHandler in v5 #1063

Description

@siebe1996

Hi,
In previous versions of Caliburn.Micro, I used the Activated event to start loading data after a screen/dialog was activated. Since Activated was an EventHandler, I could use an async void event handler and allow the dialog to appear immediately while the data loaded in the background.
In v5 #763 , Activated changed from:
public event EventHandler<ActivationEventArgs> Activated;Show more lines
to:
public event AsyncEventHandler<ActivationEventArgs> Activated;Show more lines
This changes the behavior of the pattern I was previously using.
I found issue #773 where OnInitializeAsync is recommended as the place to load data. However, when I open a dialog using IWindowManager.ShowDialogAsync, the dialog is not displayed until the data loading has completed. The behavior I had before was that the dialog became visible immediately and the data loaded afterwards.
What is the recommended pattern in v5 for scenarios where a dialog opened via IWindowManager.ShowDialogAsync should become visible immediately and data loading should not block the dialog from being shown?
I'm not looking for a workaround, but rather for guidance on the intended/recommended approach now that Activated is asynchronous.
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions