private void OK_Click(object sender, RoutedEventArgs e) { User u; if (!UN_Field_SW.Text.Equals("") && !EM_Field_SW.Text.Equals("") && !PS_Field_SW.Password.Equals("")) { if ((u = model.addUser(EM_Field_SW.Text, UN_Field_SW.Text, PS_Field_SW.Password)) != null) { MessageBox.Show("Welcome, " + UN_Field_SW.Text + "!\nHave a great time!", "Welcome", MessageBoxButton.OK); MapWindow mp = new MapWindow(u); doNotShow = true; mp.Show(); this.Close(); } else { MessageBox.Show("Username " + UN_Field_SW.Text + " already exists.\nPlease choose different username", "Sign In Error", MessageBoxButton.OK, MessageBoxImage.Error); } } else { MessageBox.Show("Please check if you filled in all information.", "Sign In Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void LogIn_Click(object sender, RoutedEventArgs e) { if (model.checkLoginData(UN_Field_LW.Text, PS_Field_LW.Password)) { User u = model.getUser(UN_Field_LW.Text); MapWindow mp = new MapWindow(u); doNotShow = true; mp.Show(); this.Close(); } else { MessageBox.Show("Please check your credentials.", "Log In Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }