private void OnLoggedInMessageReceived(string username) { if (username == "un_authorized_user") { login = new LoginView(); var loginVM = new LoginViewModel(authoService); login.DataContext = loginVM; login.Show(); app.Close(); } else { app = new ApplicationView(); var appVM = new ApplicationViewModel(); app.DataContext = appVM; app.Show(); login.Close(); } }