protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); FacebookSdk.SdkInitialize(this.ApplicationContext); mProfileTracker = new MyProfileTracker(); mProfileTracker.mOnProfileChanged += mProfileTracker_mOnProfileChanged; mProfileTracker.StartTracking(); // Setting Layout SetContentView(Resource.Layout.RegisterAccount); // getting editText nom = FindViewById <EditText>(Resource.Id.reg_lname_text); prenom = FindViewById <EditText>(Resource.Id.reg_fname_text); email = FindViewById <EditText>(Resource.Id.reg_email_text); mdp = FindViewById <EditText>(Resource.Id.reg_pwd_text); mdp2 = FindViewById <EditText>(Resource.Id.reg_confPwd_text); pseudo = FindViewById <EditText>(Resource.Id.reg_pseudo_text); // Login if already have an account TextView loginTextView = FindViewById <TextView>(Resource.Id.reg_signin_text); loginTextView.Click += delegate { StartActivity(typeof(LoginActivity)); }; // Facebook Configuration LoginButton button = FindViewById <LoginButton>(Resource.Id.reg_cnxFacebook_btn); button.SetReadPermissions(new List <string> { "public_profile", "user_friends", "email" }); mCallBackManager = CallbackManagerFactory.Create(); button.RegisterCallback(mCallBackManager, this); // bouton enregistrement inscription Button registerButton = FindViewById <Button>(Resource.Id.register_btn); registerButton.Click += delegate { // verification des champs bool error = false; if (!error) { error = verifText("prenom", prenom); } if (!error) { error = verifText("nom", nom); } if (!error) { error = verifText("pseudo", pseudo); } if (!error) { error = verifText("email", email); } if (!error) { error = verifText("mot de passe", mdp); } if (!error) { error = verifText("confirmation de mot de passe", mdp2); } if (!error && mdp.Text.ToString() != mdp2.Text.ToString()) { error = true; Toast.MakeText(this, "Les mots de passe ne correspondent pas", ToastLength.Long).Show(); } // Vérification de la saisie !!! if (!error) { User user = new User(prenom.Text, nom.Text, pseudo.Text, email.Text, mdp.Text); DataBase.Inscription(user); DataBase.connected = true; StartActivity(typeof(ProfileActivity)); } }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); FacebookSdk.SdkInitialize(this.ApplicationContext); mProfileTracker = new MyProfileTracker(); mProfileTracker.mOnProfileChanged += mProfileTracker_mOnProfileChanged; mProfileTracker.StartTracking(); // Setting Layout SetContentView(Resource.Layout.RegisterAccount); // getting editText nom = FindViewById<EditText>(Resource.Id.reg_lname_text); prenom = FindViewById<EditText>(Resource.Id.reg_fname_text); email = FindViewById<EditText>(Resource.Id.reg_email_text); mdp = FindViewById<EditText>(Resource.Id.reg_pwd_text); mdp2 = FindViewById<EditText>(Resource.Id.reg_confPwd_text); pseudo = FindViewById<EditText>(Resource.Id.reg_pseudo_text); // Login if already have an account TextView loginTextView = FindViewById<TextView>(Resource.Id.reg_signin_text); loginTextView.Click += delegate { StartActivity(typeof(LoginActivity)); }; // Facebook Configuration LoginButton button = FindViewById<LoginButton>(Resource.Id.reg_cnxFacebook_btn); button.SetReadPermissions(new List<string> { "public_profile", "user_friends", "email" }); mCallBackManager = CallbackManagerFactory.Create(); button.RegisterCallback(mCallBackManager, this); // bouton enregistrement inscription Button registerButton = FindViewById<Button>(Resource.Id.register_btn); registerButton.Click += delegate { // verification des champs bool error = false; if (!error) error = verifText("prenom", prenom); if (!error) error = verifText("nom", nom); if (!error) error = verifText("pseudo", pseudo); if (!error) error = verifText("email", email); if (!error) error = verifText("mot de passe", mdp); if (!error) error = verifText("confirmation de mot de passe", mdp2); if (!error && mdp.Text.ToString() != mdp2.Text.ToString()) { error = true; Toast.MakeText(this, "Les mots de passe ne correspondent pas", ToastLength.Long).Show(); } // Vérification de la saisie !!! if (!error) { User user = new User(prenom.Text, nom.Text, pseudo.Text, email.Text, mdp.Text); DataBase.Inscription(user); DataBase.connected = true; StartActivity(typeof(ProfileActivity)); } }; }