I have a login form which starts a dialog of a lecturerWindow
When swapping windows it looks like that:
//LoginWindow to LecturerClient
this.Visibility = Visibility.Collapsed;
LecturerWindow lecturerClient = new LecturerWindow(self);
lecturerClient.Owner = this;
lecturerClient.ShowDialog();
this.Visibility = Visibility.Visible; // so when the lecturerClient dialogs exits - the login form will be visible
And also my LecturerWindow opens another dialog:
//LecturerClient To Session
Dispatcher.Invoke(() =>
{
Visibility = Visibility.Collapsed;
Session newSession = new Session(mySelf, Courses.Find(item => item.courseId == courses[1].ToString()));
newSession.Owner = this;
newSession.ShowDialog();
Visibility = Visibility.Visible;
});
The issue begins when my Session dialog closes and suddenly both my LoginWindow and my LecturerWindow goes Visible, it's like my LoginWindow thinks the session closing is the lecturerWindow closing
Thank you in advance!
Dispatcher.Invoke
is what's causing the problem. I was able to reproduce your issue, and removing that line fixes it. Not sure what you're using it for, though, so removing it might not be an option.