private void TxtReg_Click(object sender, MouseButtonEventArgs e) { RegWindow reg = new RegWindow(); reg.ShowDialog(); this.txtEmail.Text = reg.txtEmail.Text; this.txtPass.Password = reg.txtPass.Password; BtnLogin_Click(sender, e); }
private void BtnLogin_Click(object sender, RoutedEventArgs e) { if (!IsFind()) { MessageBoxResult result = MessageBox.Show("user no found! try again?", "!!!", MessageBoxButton.YesNoCancel); switch (result) { case MessageBoxResult.Cancel: this.Close(); break; case MessageBoxResult.Yes: return; case MessageBoxResult.No: RegWindow reg = new RegWindow(); reg.ShowDialog(); this.txtEmail.Text = reg.txtEmail.Text; this.txtPass.Password = reg.txtPass.Password; BtnLogin_Click(sender, e); return; default: break; } } MainWindow main = new MainWindow(); main.Fname = this.Fname; main.Lname = this.Lname; main.Email = this.Email; main.ShowDialog(); txtEmail.Text = null; txtPass.Password = null; imgUser.Source = new BitmapImage(new Uri("https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/No_image_available.svg/480px-No_image_available.svg.png")); this.Close(); }