Exemplo n.º 1
0
 private void FieldCompleted(object sender, EventArgs e)
 {
     if (sender == EntryRecepient)
     {
         if (!ValidationHelper.ValidateTextField(EntryRecipientPhoneNumber.Text))
         {
             EntryRecipientPhoneNumber.Focus();
         }
     }
     else if (sender == EntryPayment)
     {
         if (!ValidationHelper.ValidateNumber(EntryCollateral.Text))
         {
             EntryCollateral.Focus();
         }
     }
     else if (sender == EntryCollateral)
     {
         if (!ValidationHelper.ValidateNumber(EntryPayment.Text))
         {
             EntryPayment.Focus();
         }
     }
 }
Exemplo n.º 2
0
        protected override bool IsValid()
        {
            if (!ValidationHelper.ValidateTextField(EntryRecepient.Text))
            {
                EntryRecepient.FocusField();
                Scroll();
                return(false);
            }
            else if (!ValidationHelper.ValidateTextField(ViewModel.LauncherFullPhoneNumber))
            {
                EntryLauncherPhoneNumber.Focus();
                Scroll();
                return(false);
            }
            else if (!ValidationHelper.ValidateTextField(ViewModel.RecipientFullPhoneNumber))
            {
                EntryRecipientPhoneNumber.Focus();
                Scroll();
                return(false);
            }
            else if (!ValidationHelper.ValidateTextField(ViewModel.FromLocationGPS))
            {
                EventHandler handleHandler = (s, e) => {
                    var picker = new LocationPickerPage(LocationPickerType.From);
                    picker.eventHandler = DidSelectLocationHandler;
                    Navigation.PushAsync(picker, true);
                };

                ShowErrorMessage(AppResources.LocationsNotSet, false, handleHandler);

                return(false);
            }
            else if (!ValidationHelper.ValidateTextField(ViewModel.ToLocationGPS))
            {
                EventHandler handleHandler = (s, e) => {
                    var picker = new LocationPickerPage(LocationPickerType.To);
                    picker.eventHandler = DidSelectLocationHandler;
                    Navigation.PushAsync(picker, true);
                };

                ShowErrorMessage(AppResources.LocationsNotSet, false, handleHandler);

                return(false);
            }
            else if (PhotoSource == null)
            {
                EventHandler handleHandler = (s, e) => {
                    OnTakePhoto(PhotoButton, null);
                };

                ShowErrorMessage(AppResources.SelectPackagePhoto, false, handleHandler);

                return(false);
            }
            else if (!ValidationHelper.ValidateTextField(EntryDeadline.Text))
            {
                EventHandler handleHandler = (s, e) => { 
 EntryDeadline.Focus(); 
 }; 

                ShowErrorMessage(AppResources.SelectDeadlineDate, false, handleHandler); 

                return(false);
            }
            else if (!ValidationHelper.ValidateNumber(EntryPayment.Text))
            {
                EntryPayment.Focus();

                return(false);
            }
            else if (!ValidationHelper.ValidateNumber(EntryCollateral.Text))
            {
                EntryCollateral.Focus();

                return(false);
            }
            else if (!ValidationHelper.ValidateTextField(EntryDescription.Text))
            {
                EntryDescription.Focus();
                Scroll();

                return(false);
            }


            return(true);
        }