Ejemplo n.º 1
0
        private async void SubmitBtn_Click(object sender, RoutedEventArgs e)
        {
            if (!UserValidator.CheckEmail(emailBox.Text))
            {
                MessageBox.Show(UserValidator.CheckEmailMessage());
                return;
            }

            if (!UserValidator.CheckName(nameBox.Text))
            {
                MessageBox.Show(UserValidator.CheckNameMessage());
                return;
            }

            if (!UserValidator.CheckSurname(surnameBox.Text))
            {
                MessageBox.Show(UserValidator.CheckSurnameMessage());
                return;
            }

            bool res = await service.EditProfileAsync(token, nameBox.Text, surnameBox.Text, emailBox.Text);

            if (res)
            {
                MessageBox.Show("Профіль змінено!");

                this.DialogResult = true;
                this.Close();
            }
            else
            {
                MessageBox.Show("Щось не так :(");
            }
        }