コード例 #1
0
        async void OnButtonClicked(object sender, EventArgs args)
        {
            int buttonNo = Int32.Parse(((Button)sender).StyleId);

            System.Diagnostics.Debug.WriteLine(buttonNo);
            if (buttonNo == 10 && index != 0)
            {
                index -= 1;
                labels[index].Text      = "0";
                labels[index].TextColor = Color.FromHex("#FAFAFA");
            }
            else if (buttonNo != 10)
            {
                labels[index].Text      = buttonNo.ToString();
                labels[index].TextColor = Color.FromHex("#000000");
                index += 1;
            }
            if (index == 4)
            {
                System.Diagnostics.Debug.WriteLine("x");
                string password  = labels[0].Text + labels[1].Text + labels[2].Text + labels[3].Text;
                bool   pwcorrect = false;
                try  {
                    pwcorrect = await App.Database.ValidateLogin(emailEntry.Text, Int32.Parse(password));

                    Registratie user = await App.Database.RegisterQuerry(emailEntry.Text);

                    GlobalVariables.user = user;
                } catch
                {
                }

                if (pwcorrect)
                {
                    index = 0;
                    for (int i = 0; i < labels.Count; i++)
                    {
                        labels[i].Text      = "0";
                        labels[i].TextColor = Color.FromHex("#FAFAFA");
                    }
                    await Navigation.PushAsync(new HomePage());
                }
                else
                {
                    index = 0;
                    await Task.Delay(200);

                    for (int i = 0; i < labels.Count; i++)
                    {
                        labels[i].Text      = "0";
                        labels[i].TextColor = Color.FromHex("#FAFAFA");
                    }
                    await DisplayAlert("Error", "Email or password incorrect", "OK");
                }
            }
        }
コード例 #2
0
        private async void Registratie_Clicked(object sender, EventArgs e)
        {
            List <string> test = new List <string>()
            {
                voorNaam.Text,
                achterNaam.Text,
                postcode.Text,
                straat.Text,
                straatNo.Text,
                email.Text,
                code0.Text,
                code1.Text,
                wPlaats.Text
            };
            DateTime x = geboorteDatum.Date;

            if (code0.Text != code1.Text)
            {
                await DisplayAlert("Error", "passwords are not the same", "OK");

                return;
            }
            Registratie r = new Registratie()
            {
                Achternaam     = achterNaam.Text,
                Voornaam       = voorNaam.Text,
                Emailadres     = email.Text.ToLower(),
                Gebruikerscode = Int32.Parse(code0.Text),
                Geboortedatum  = geboorteDatum.Date,
                Postcode       = postcode.Text,
                Woonplaats     = wPlaats.Text,
            };
            await App.Database.RegisterPerson(r);

            Application.Current.Properties["email"] = email.Text.ToLower();
            await Navigation.PushAsync(new LogIn());
        }
コード例 #3
0
 public Task <int> RegisterPerson(Registratie user)
 {
     return(_database.InsertAsync(user));
 }