开发者

When is the soonest I can Close my window?

开发者 https://www.devze.com 2022-12-18 02:20 出处:网络
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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消