c# - WPF: Close and open windows -
in case have main window , login view..
when main window closed, login window should displayed. close so:
void closeoncompleteanddisplaylogin(object sender, runworkercompletedeventargs e) { this.close(); new login().show(); }
in login window open mainwindow so:
this.hide(); var window = new mainwindow(model).show();
problem: when login , open mainwindow first time works fine... when close mainwindow , login again, several functions of main window stop working or start throwing exceptions..
what doing wrong here? figured "window_loaded" events not triggered on re-login..
yes, loaded
not triggered if hide/show. instead use shown
event initialize logic.
Comments
Post a Comment