private void BTT_OK_Click(object sender, RoutedEventArgs e) { // ID 및 PW 매칭 검사 string PW = PB_PW.Password; string NewPW = PB_NewPW.Password; string ConfirmNewPW = PB_ConfirmNewPW.Password; string NewPWH = TB_HintForPW.Text; if (PW != MainWindow.PW) { MessageBox.Show("PW is incorrect."); } else if (NewPW.Length < 4) { MessageBox.Show("PW must have at least 4 digits."); } else if (ConfirmNewPW != NewPW) { MessageBox.Show("New PW for confirmation is incorrect."); } else { MainWindow.userInfo[MainWindow.loginIndex] = new string[] { MainWindow.ID, NewPW, NewPWH }; MainWindow.SaveFile("user.dat", MainWindow.userInfo, -5); MessageBox.Show("Changing PW Finished."); Close(); } }
private void BTT_OK_Click(object sender, RoutedEventArgs e) { // ID 및 PW 매칭 검사 string NewID = TB_NewID.Text; string NewPW = PB_NewPW.Password; string PWH = TB_HintForPW.Text; string[] find = MainWindow.userInfo.Find(delegate(string[] x) { return(x[0] == NewID); }); // 계정 등록 if (NewID.Length < 4) { MessageBox.Show("ID must have at least 4 characters."); } else if (find != null) { MessageBox.Show("The ID already exists. Try other one."); } else if (NewPW.Length < 4) { MessageBox.Show("PW must have at least 4 digits."); } else if (NewPW != PB_ConfirmNewPW.Password) { MessageBox.Show("New PW for confirmation is incorrect."); } else { MainWindow.userInfo.Add(new string[3] { NewID, NewPW, PWH }); MainWindow.SaveFile("user.dat", MainWindow.userInfo, -5); MessageBox.Show("Registering ID Finished."); Close(); } }