Skip to content

What is the purpose of IWindowCreator? #26327

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

You must be logged in to vote

I'm currently using this approach where I register the class below as a singleton IWindowCreator.
I improved upon some problems I recognised in the documented approach:

  • Decouples main page lifetime from the application and its main window entirely. E.g. it can be called to recreate a main window without recreating the main page.
    Think of apps like Spotify and Discord that close their main window, but keep running, and leave some method to create a new main window again, that shows the page as it were when you closed it.
  • Can be called to create subsequent non-main windows that will not show the main page.
public class WindowCreator : IWindowCreator
{
  public Window CreateWindow(Application

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@Ghostbird
Comment options

@MartyIX
Comment options

MartyIX Dec 4, 2024
Collaborator

Comment options

You must be logged in to vote
0 replies
Answer selected by Ghostbird
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