Beispiel #1
0
 public NameForm()
 {
     InitializeComponent();
     NameEntry.Text = "Anonymous";
     NameEntry.SelectAll();
     NameEntry.Focus();
 }
 private async void EditName_OnTapped(object sender, EventArgs e)
 {
     if (NameEntry.InputTransparent)
     {
         NameEntry.InputTransparent = false;
         await PenIcon.FadeTo(0, 100u);
     }
     NameEntry.Focus();
     NameEntry.CursorPosition = NameEntry.Text.Length;
 }
 private void WeightEntry_Completed(object sender, EventArgs e)
 {
     if (WeightEntry.Text.ToString() != string.Empty)
     {
         int i = 0;
         // Go to Name
         bool result = int.TryParse(WeightEntry.Text.ToString(), out i);
         if (result == true)
         {
             singleItem.Weight     = i;
             WeightEntry.IsEnabled = false;
             NameEntry.IsVisible   = true;
             NameEntry.Focus();
         }
         else
         {
             App.Current.MainPage.DisplayAlert("Alert", "Please round to the nearest whole number.", "Continue");
         }
     }
 }
Beispiel #4
0
        public void Automate()
        {
            var vm = new RegisterStudentViewModel(Navigation);

            UsernameEntry.Completed += (object sender, EventArgs e) =>
            {
                PasswordEntry.Focus();
            };
            PasswordEntry.Completed += (object sender, EventArgs e) =>
            {
                ConfirmPasswordEntry.Focus();
            };
            ConfirmPasswordEntry.Completed += (object sender, EventArgs e) =>
            {
                PhoneNumberEntry.Focus();
            };
            PhoneNumberEntry.Completed += (object sender, EventArgs e) =>
            {
                NameEntry.Focus();
            };
            NameEntry.Completed += (object sender, EventArgs e) =>
            {
                AgeEntry.Focus();
            };
            AgeEntry.Completed += (object sender, EventArgs e) =>
            {
                ClassEntry.Focus();
            };
            ClassEntry.Completed += (object sender, EventArgs e) =>
            {
                INameEntry.Focus();
            };
            INameEntry.Completed += (object sender, EventArgs e) =>
            {
                vm.RegisterStudent.Execute(null);
            };
        }
Beispiel #5
0
        private async void Btnregister_OnClicked(object sender, EventArgs e)
        {
            try
            {
                if (NameEntry.Text == null)
                {
                    await DisplayAlert("Field required", "Please enter you full name. This will be used upon checking out items or picking them up.", "OK");

                    NameEntry.Focus();
                    return;
                }

                if (mobileentry.Text == null)
                {
                    await DisplayAlert("Field required", "Please enter you mobile number.", "OK");

                    mobileentry.Focus();
                    return;
                }

                if (emailentry.Text == null)
                {
                    await DisplayAlert("Field required", "Please enter your email address", "OK");

                    emailentry.Focus();
                    return;
                }

                if (passentry.Text == null)
                {
                    await DisplayAlert("Field required", "Please enter your password", "OK");

                    passentry.Focus();
                    return;
                }

                if (confirmpassentry.Text == null)
                {
                    await DisplayAlert("Field required", "Please confirm your password", "OK");

                    confirmpassentry.Focus();
                    return;
                }

                if (lblerror.IsVisible)
                {
                    await DisplayAlert("Error", "Invalid email address!", "OK");

                    emailentry.Focus();
                    return;
                }

                if (loadingindicator.IsVisible)
                {
                    return;
                }
                if (passentry.Text == confirmpassentry.Text)
                {
                    var user = new TBL_Users
                    {
                        full_name  = NameEntry.Text,
                        mobile_num = mobileentry.Text,
                        emailadd   = emailentry.Text,
                        password   = passentry.Text,
                        datereg    = DateTime.Now
                    };
                    loadingindicator.IsVisible = true;
                    loadingindicator.IsRunning = true;
                    indicatornot.IsVisible     = true;
                    await TBL_Users.Insert(user);
                    await DisplayAlert("Success", "You've successfully signed up! Please login to your account now!", "OK");

                    indicatornot.IsVisible     = false;
                    loadingindicator.IsVisible = false;
                    await Navigation.PopAsync(true);
                }
                else
                {
                    await DisplayAlert("Confirm password", "Password did not match!", "OK");

                    confirmpassentry.Focus();
                }
            }
            catch
            {
                indicatornot.IsVisible     = false;
                loadingindicator.IsVisible = false;
                await DisplayAlert("Error", "There was an error processing your request. " +
                                   "The email address you've entered already exist. Please try another one. " +
                                   "Please check you internet connectivity as well.", "OK");
            }
        }