public async void btnNext2(object sender, RoutedEventArgs e) { await databaseObject.InsertAsync(bi); History newWindow = new History(personalInfoObject); newWindow.Show(); this.Close(); }
private void btnNext(object sender, RoutedEventArgs e) { if (tbemail.Text.Length == 0) //email validation using regular expressions { MessageBox.Show("Enter your email"); tbemail.Focus(); return; } else if (!Regex.IsMatch(tbemail.Text, @"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$")) { MessageBox.Show("Enter a valid email"); tbemail.Select(0, tbemail.Text.Length); tbemail.Focus(); return; } if (personalInfoObject.WillingToHelp == true) { MessageBox.Show("Your free Tim Hortons voucher code is 123456*** "); Background newWindow = new Background(personalInfoObject); newWindow.Show(); } else if(personalInfoObject.WillingToHelp == false) { History newWindow = new History(personalInfoObject); newWindow.Show(); } // await db.InsertAsync(pi); this.Close(); }