private void PickerFocused(object sender, Xamarin.Forms.FocusEventArgs e) { EntryDeadline.Unfocus(); Unfocus(); var dpc = new DatePromptConfig(); dpc.OkText = AppResources.OK; dpc.CancelText = AppResources.Cancel; dpc.IsCancellable = true; dpc.MinimumDate = DateTime.Today.AddDays(1); dpc.SelectedDate = ViewModel.DeadlineDT.Date; dpc.Title = AppResources.PickDeadlineDate; dpc.OnAction = dateResult => { if (dateResult.Ok) { var date = dateResult.SelectedDate.Date; date = date.AddSeconds(86399);//23:59.59 of selected day ViewModel.Deadline = DateTimeHelper.ToUnixTime(date.ToUniversalTime()); EntryDeadline.Text = ViewModel.DeadlineString; SelectButton(CustomDateButton); } }; UserDialogs.Instance.DatePrompt(dpc); }
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); }