Exemplo n.º 1
0
        private void ChooseAccountButton_Click(object sender, RoutedEventArgs e)
        {
            var chooseAccountWindow = new ChooseAccountWindow();

            chooseAccountWindow.Show();
            this.Close();
        }
Exemplo n.º 2
0
        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
            }
        }