In a WPF window, how do I know if it is opened?
My goal to open only 1 instance of the window at the time.
So, my pseudo code in the parent window is:
if (this.m_myWindow != null)
{
if (this.m_myWindow.ISOPENED) return;
}
this.m_myWindow = new MyWindow();
this.m_myWindow.Show();
EDIT:
I found a solution that solves my initial problem.
window.ShowDialog();
It blocks the user from opening any other window, just like a modal popup.
Using this command, it is not necessary to check if the window is already open.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…