コード例 #1
0
        private void DoneBtn_Click(object sender, EventArgs e)
        {
            TodoistService todoistService = new TodoistService();

            doneBtn.IsEnabled = false;

            if (validateForm())
            {
                todoistService.SignUp(NameTextBox.Text, EmailTextBox.Text, PasswordBox.Password,
                (data) =>
                {
                    app.loginInfo = data;
                    NavigationService.Navigate(Utils.MainTodoistPage(true));
                },
                (errorMsg) =>
                {
                    MessageBox.Show(errorMsg, "Metroist", MessageBoxButton.OK);
                    doneBtn.IsEnabled = true;
                });
            }
            else
            {
                if (!(GeneralLib.Utils.IsValidEmail(EmailTextBox.Text)))
                {
                    MessageBox.Show("You have entered a invalid e-mail. Please try again.", "Metroist", MessageBoxButton.OK);
                }
                else if (!(PasswordBox.Password.Length >= 5))
                {
                    MessageBox.Show("Your password must have at least 5 characters.", "Metroist", MessageBoxButton.OK);
                }

                doneBtn.IsEnabled = true;
            }
        }