private void LoginButtonLoginWindow_Click(object sender, RoutedEventArgs e) { if (!_repo.AreThereAnyUsers()) { MessageBox.Show("No any user in system! \nPlease, register"); return; } if (string.IsNullOrWhiteSpace(EmailTextBox.Text)) { MessageBox.Show("Please, enter email!"); EmailTextBox.Focus(); return; } if (string.IsNullOrWhiteSpace(PasswordTextBox.Password)) { MessageBox.Show("Please, enter password!"); PasswordTextBox.Focus(); return; } if (_repo.AutentificateUser(EmailTextBox.Text, User.GetHash(PasswordTextBox.Password)) == null) { MessageBox.Show("No such user! \nCheck your credentials or register in the system"); } else { MainWindow mainWindow = new MainWindow(_repo, _repo.AutentificateUser(EmailTextBox.Text, User.GetHash(PasswordTextBox.Password))); mainWindow.Show(); this.Close(); } }