When is the soonest I can Close my window?
I perform some ch开发者_StackOverflow社区ecks in my Window class constructor, and if they fail I want to display an error message and close the window.
I'm getting crashes when calling Close() from the constructor or from Window_Loaded. Does that sounds normal or am I doing something wrong? If this is normal, when should I call Close()?
It turns out you can call Close() in the constructor or on Window_Loaded - I was just doing something wrong later on in the destructor.
I would recommend performing those checks before showing the window and if they fail, then display the error. In other words, don't show the window unless it's ok to do so.
精彩评论