C# A trouble regarding Window.ShowDialog

痞子三分冷 提交于 2020-01-06 13:57:36

问题


I have my custom message box class, which inherits Window class and has a method to automatically close itself after the designated time collapsed. I'm in trouble with the ShowDialog method of this class when I'm in a case described below.

  1. There emerges a ShowDialog of a custom message box, which is set to automatically close in several seconds.

  2. Before the first one is closed, there emerges a ShowDialog of another custom message box, which is not set to automatically close.

  3. When the first one is closed, the ShowDialog function of the second one becomes invalid, ie. the MainWindow becomes selectable.

This problem happens no matter whether each custom message box emerges from a single thread or not.

How can I avoid this? If it is necessary to override ShowDialog, how is it possible?

来源:https://stackoverflow.com/questions/26668524/c-sharp-a-trouble-regarding-window-showdialog

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!