private void ChooseAccountButton_Click(object sender, RoutedEventArgs e) { var chooseAccountWindow = new ChooseAccountWindow(); chooseAccountWindow.Show(); this.Close(); }
private void CreateUserButton_Click(object sender, RoutedEventArgs e) { var validationResult = _userService.ValidateUserData(this.firstNameTextBox.Text, this.dateOfBirthDatePicker.SelectedDate); if (validationResult.Item1) // Item1 corresponds to result of validation - true means that User data are correct { try { _userService.CreateNewUser(this.firstNameTextBox.Text, this.dateOfBirthDatePicker.SelectedDate.Value); } catch (Exception) { throw; } ChooseAccountWindow chooseAccountWindow = new ChooseAccountWindow(); chooseAccountWindow.Show(); this.Close(); } else { MessageBox.Show(validationResult.Item2); // Item2 corresponds to error message after data validation } }