Skip to content

Dialog not showing when the first DialogContainer is not yet created #9

@schdck

Description

@schdck

When trying to show a dialog before the first DialogContainer is created, there's no one subscribed to DialogManager, so it sillently fails (no exception is thrown, because it is configured to just return null).

I think this behavior is very confusing and should be changed. Right now, I think the possibilities are:

  • Option A: Throw an exception instead of just returning null (this could be usefull when the user forgot to create a DialogContainer, but would make the process of showing a dialog before the window was created very painful¹)
  • Option B: Add the shown dialog to the Stack and display it as soon as someone subscribe

In case we choose Option B, something to keep in mind is: what Task to return from ShowDialogAsync/ShowDialogForResult? Since the Stack is implemented on the DialogContainer and there's none, another Stack would need to be implemented on the DialogManager.

¹ Imagine a scenario where the application loads some data on startup and it fails. So you catch the exception and try to display a dialog with it, but your window is not yet initialized (because your application is just starting up). As I see, if we were to thrown an Exception, user would need to either move the load data code to after the Window is initialized and the DialogContainer is created (which can be good sometimes, but is not something I want to force on users) or just show the dialog after the DialogContainer is created (which is almost the same thing as Option A, but done in the the end-user code instead of here)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAn enhancement to the framework

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions