private void btnTest_Click(object sender, RoutedEventArgs e) { UserRegistrationAudio ss = new UserRegistrationAudio(txtUsername.Text); ss.Show(); this.Close(); }
private void btnRegistration_Click(object sender, RoutedEventArgs e) { if (db.Users.SingleOrDefault(x => x.username == txtUsername.Text) != null) { MessageBox.Show("Username is already exist!", "Error", MessageBoxButton.OK); return; } string temp = ""; if (!String.IsNullOrEmpty((temp = validation(txtUsername.Text, "Username")))) { MessageBox.Show(temp, "Error", MessageBoxButton.OK); return; } if (!String.IsNullOrEmpty((temp = validation(txtName.Text, "Name")))) { MessageBox.Show(temp, "Error", MessageBoxButton.OK); return; } if (txtPassword.Password == "xxxxxxx") { txtPassword.Password = ""; } if (!String.IsNullOrEmpty((temp = validation(txtPassword.Password, "Password")))) { MessageBox.Show(temp, "Error", MessageBoxButton.OK); return; } if (!String.IsNullOrEmpty((temp = validation(txtFamilyId.Text, "FamilyId")))) { MessageBox.Show(temp, "Error", MessageBoxButton.OK); return; } if (!String.IsNullOrEmpty((temp = validation(txtAge.Text, "Age")))) { MessageBox.Show(temp, "Error", MessageBoxButton.OK); return; } regUser.username = txtUsername.Text.Trim(); regUser.name = txtName.Text.Trim(); regUser.password = txtPassword.Password.Trim(); regUser.age = txtAge.Text.Trim(); regUser.photofile = ConfigurationSettings.AppSettings.Get("photoslocation") + txtUsername.Text + ".jpg"; regUser.familyid = txtFamilyId.Text.Trim(); Helper.SaveImageCapture((BitmapSource)image1.Source, regUser.photofile); db.Users.InsertOnSubmit(regUser); db.SubmitChanges(); MessageBox.Show("Registration successful, please record your voice for speaker recognition login!", "Successful", MessageBoxButton.OK); //GC.Collect(); UserRegistrationAudio mw = new UserRegistrationAudio(txtUsername.Text); mw.Show(); this.Close(); }