In some context here ... I have a System.Windows.Window that is used to display a modal message box. I created the Show () method, which initializes the contents of the window, and then calls ShowDialog (). The user clicks a button in this window, some information about the pressed button is set in the tag property, and then the window is closed using Close ().
As expected, I get a ShowDialog exception when I try to call ShowDialog () on the window once when it was closed. Is there a way to reuse the same instance of Window so that I don't have to update the instance every time I need a message box?
For instance...
MessageBoxWindow mbw = new MessageBoxWindow(); result = mbw.Show("caption", "message 1"); mbw.Show("caption", "message 2"); // The above throws an exception, so I have to do this... mbw = new MessageBoxWindow(); result = mbw.Show("caption", "message 2");
Any help would be greatly appreciated!
source share