Exemplo n.º 1
0
        //void ContentPanel_Loaded(object sender, RoutedEventArgs e)
        // {

        // }

        void btnCreate_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            // creating new account, verify info first:
            if (txtName.Text == "")
            {
                MessageBox.Show("Please enter your full name");
                return;
            }
            else if (!ValidChars(txtName.Text))
            {
                MessageBox.Show("Only use alphanumeric characters for full name");
                return;
            }


            // come back to age verification:
            if (!VerifyAge(dpDob.Value))
            {
                MessageBox.Show("You must be 21 years old to use this app");
                return;
            }

            if (txtEmail.Text == "")
            {
                MessageBox.Show("Please enter your email address");
                return;
            }

            if (txtEmail.Text.Contains("@") == false)
            {
                MessageBox.Show("Please enter a valid email address");
                return;
            }

            if (txtPassword.Password.Length < 6)
            {
                MessageBox.Show("Password must be at least 6 characters");
                return;
            }

            // get the gender from the list picker:
            ListPickerItem selectedGender = (ListPickerItem)lpGender.SelectedItem;
            string         gender         = selectedGender.Content.ToString();

            if (gender == "Choose a gender...")
            {
                gender = "";
            }


            // passed validation, create the account:
            ParseHelper.CreateNewAccount(txtEmail.Text, txtPassword.Password, txtName.Text, (DateTime)dpDob.Value, gender, txtZip.Text);
        }