Esempio n. 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Key);

            EditText pEmail = FindViewById <EditText>(Resource.Id.txtEmail);
            EditText pPass1 = FindViewById <EditText>(Resource.Id.txtUserPassword);
            EditText pPass2 = FindViewById <EditText>(Resource.Id.txtUserPassword2);

            Button pSubmit = FindViewById <Button>(Resource.Id.btnSetPassword);

            pSubmit.Click += delegate
            {
                if (pEmail.Text == "")
                {
                    Master.Popup(this, "Your email cannot be blank.");
                }
                if (pPass1.Text == "")
                {
                    Master.Popup(this, "Your password cannot be blank.");
                    return;
                }

                if (pPass1.Text != pPass2.Text)
                {
                    Master.Popup(this, "The password fields do not match.");
                    return;
                }


                string   sBody     = "<params><param name='sEmail'>" + pEmail.Text.ToString() + "</param><param name='sPassword'>" + Security.Sha256Hash(pPass1.Text.ToString()) + "</param></params>";
                string   sResponse = WebCommunications.SendPostRequest(Master.GetBaseURL() + Master.GetServerURL() + "RegisterUser", sBody, true);
                XElement pResponse = Master.ReadResponse(sResponse);

                string sResponseMessage = pResponse.Element("Text").Value;

                if (pResponse.Attribute("Type").Value == "Error")
                {
                    Popup(sResponseMessage);
                    return;
                }
                else
                {
                    //MessageBox.Show(sResponseMessage);
                    Master.HandleUserRegistrationData(pResponse);
                    this.Finish();
                }
            };
        }