private void register_click(Object sender, RoutedEventArgs e) { mw_model.Username = username.Text; Content = null; Content = new RegisterUC(); }
private void login_click(Object sender, RoutedEventArgs e) { var curWindow = Window.GetWindow(this); mw_model mw = new mw_model(); string user = username.Text; string pw = password.Password; if (user == "" || pw == "") { MessageBox.Show("Please enter a username and password."); return; } if (mw.UserExists(user, pw)) { mw_model.Username = user; mw_model.Password = pw; MainWindow m = new MainWindow(); m.Show(); curWindow.Close(); } else { // TODO register new user if (MessageBox.Show("This user does not exist. Do you want to create an account?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { Content = null; Content = new RegisterUC(); } else { } } }