void RegistrationDialog_gOnRegistrationComplete (object sender, OnRegistration e) { string userPassword = e.Password; string userName = e.FirstName; string userEmail = e.Email; net.cloudapp.getuserinfo.Service1 servisas = new net.cloudapp.getuserinfo.Service1(); servisas.addPersonToRegistrationCompleted += new net.cloudapp.getuserinfo.addPersonToRegistrationCompletedEventHandler(GetCompleted); servisas.addPersonToRegistrationAsync(userName, userEmail, userPassword); servisas.addPersonToRegistrationCompleted -= new net.cloudapp.getuserinfo.addPersonToRegistrationCompletedEventHandler(GetCompleted); }
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView (inflater, container, savedInstanceState); var view = inflater.Inflate (Resource.Layout.registration_dialog, container, false); gTxtFirtName = view.FindViewById<EditText> (Resource.Id.registration_dialog_name_txt); gTxtEmail = view.FindViewById<EditText> (Resource.Id.registration_dialog_email_txt); gTxtPassword = view.FindViewById<EditText> (Resource.Id.registration_dialog_password_txt); gBtnRegister = view.FindViewById<Button> (Resource.Id.registration_dialog_btn); gBtnRegister.Click += (object sender, EventArgs e) => { if (gTxtFirtName.Text == "" || gTxtEmail.Text == "" || gTxtPassword.Text==""){ return; } bool correctEmail = true; bool correctName = true; bool correctPassword = true; bool correct = true; net.cloudapp.getuserinfo.Service1 servisas = new net.cloudapp.getuserinfo.Service1(); correctEmail = isEmailValid(gTxtEmail.Text); correctName = NameLenghtCheck(gTxtFirtName.Text); correctPassword = PasswordLenghtCheck(gTxtPassword.Text); if (correctEmail && correctName && correctPassword) { servisas.getAllNamesCompleted += new net.cloudapp.getuserinfo.getAllNamesCompletedEventHandler(GetCompleted); string[] allNames = servisas.getAllNames(); foreach(string s in allNames) { if (s == gTxtFirtName.Text) { AlertDialog.Builder alert = new AlertDialog.Builder(Activity); alert.SetTitle("ERROR"); alert.SetMessage("Name already in use"); alert.SetPositiveButton("OK", (sendAlert, EventArgs) => {}); alert.Show(); correct = false; break; } } }else { AlertDialog.Builder alert = new AlertDialog.Builder(Activity); alert.SetTitle("ERROR"); alert.SetMessage("Bad email format"); alert.SetPositiveButton("OK", (sendAlert, EventArgs) => {}); alert.Show(); correct = false; } if (correct) { servisas.addPersonToRegistrationCompleted -= new net.cloudapp.getuserinfo.addPersonToRegistrationCompletedEventHandler(GetCompleted); gOnRegistrationComplete.Invoke(this, new OnRegistration(gTxtFirtName.Text, gTxtEmail.Text, gTxtPassword.Text)); this.Dismiss(); } }; Dialog.Window.RequestFeature (WindowFeatures.NoTitle); return view; }