Ejemplo n.º 1
0
        void CreateDatePickerDialog(int year, int month, int day)
        {
            NullableDatePicker view = Element;

            _dialog = new DatePickerDialog(Context, (o, e) =>
            {
                view.Date = e.Date;
                ((IElementController)view).SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
                Control.ClearFocus();

                _dialog = null;
            }, year, month, day);

            _dialog.SetButton("OK", (sender, e) =>
            {
                SetDate(_dialog.DatePicker.DateTime);
                this.Element.Format = this.Element._originalFormat;
                this.Element.AssignValue();
            });
            _dialog.SetButton2("Limpar", (sender, e) =>
            {
                this.Element.CleanDate();
                Control.Text = this.Element.Format.Replace("\'", "");
            });
        }
        public void OnClick(object sender, EventArgs e)
        {
            HideKeyboard();
            _dialog = new DatePickerDialog(Context, this, blankPicker.Date.Year, blankPicker.Date.Month - 1,
                                           blankPicker.Date.Day);
            _dialog.DatePicker.MaxDate = UnixTimestampFromDateTime(blankPicker.MaximumDate);
            _dialog.DatePicker.MinDate = UnixTimestampFromDateTime(blankPicker.MinimumDate);

            _dialog.SetButton(blankPicker.DoneButtonText, (k, p) =>
            {
                blankPicker.Text = _dialog.DatePicker.DateTime.ToString(blankPicker.Format);
                blankPicker.Date = _dialog.DatePicker.DateTime;
                blankPicker.SendDoneClicked();
                EController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
                Control.ClearFocus();
                HideKeyboard();
            });
            _dialog.SetButton2(blankPicker.CancelButtonText, (s, el) =>
            {
                blankPicker.SendCancelClicked();
                EController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
                Control.ClearFocus();
                HideKeyboard();
            });

            _dialog.CancelEvent += _dialog_DismissEvent;


            _dialog.Show();
        }
Ejemplo n.º 3
0
        protected override DatePickerDialog CreateDatePickerDialog(int year, int month, int day)
        {
            var view   = (ExtendedDatePicker)Element;
            var dialog = new DatePickerDialog(
                Context,
                Resource.Style.DatePickerSpinnerDialogStyle,
                (o, e) =>
            {
                view.Date = e.Date;
                ((IElementController)view).SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
                Control.ClearFocus();
            },
                year,
                month,
                day);

            dialog.SetButton("Done", (sender, e) =>
            {
                Element.Format = view.OriginalFormat;
                Control.Text   = dialog.DatePicker.DateTime.ToString(Element.Format);
                view.AssignValue();
            });

            dialog.SetButton2("Clear", (sender, e) =>
            {
                view.CleanDate();
                Control.Text = Element.Format;
            });

            return(dialog);
        }
Ejemplo n.º 4
0
        private void ShowDatePicker()
        {
            _isShowing = true;

            _dialog = new DatePickerDialog(Context, DatePicker_DateSet, Element.Date.Year, Element.Date.Month - 1, Element.Date.Day);

            _dialog.SetButton("Done", (sender, e) =>
            {
                Element.SelectedDate = _dialog.DatePicker.DateTime;
                Element.UpdateDate();
                SetText();
            });

            _dialog.SetButton2("Cancel", (sender, e) =>
            {
                _dialog.Hide();
            });

            _dialog.SetButton3("Clear", (sender, e) =>
            {
                Element.SelectedDate = null;
                Element.UpdateDate();
                SetText();
            });

            _dialog.DatePicker.DateTime = Element.SelectedDate ?? DateTime.Now;
            _dialog.DismissEvent       += (sender, args) => _isShowing = false;
            _dialog.Show();
        }
        public void OnPickerClick(object sender, EventArgs e)
        {
            Xamarin.Forms.DatePicker model = Element;
            _dialog = new DatePickerDialog(Context, (o, d) =>
            {
                model.Date = d.Date;
                EController.SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
                Control.ClearFocus();

                _dialog = null;
            }, this.Element.Date.Year, this.Element.Date.Month - 1, this.Element.Date.Day);
            _dialog.DatePicker.MaxDate = UnixTimestampFromDateTime(Element.MaximumDate);
            _dialog.DatePicker.MinDate = UnixTimestampFromDateTime(Element.MinimumDate);

            _dialog.SetButton(blankPicker.DoneButtonText, (k, p) =>
            {
                this.Control.Text = _dialog.DatePicker.DateTime.ToString(Element.Format);
                Element.Date      = _dialog.DatePicker.DateTime;
                blankPicker.SendDoneClicked();
            });
            _dialog.SetButton2(blankPicker.CancelButtonText, (s, el) =>
            {
                blankPicker.SendCancelClicked();
            });
            _dialog.Show();
        }
        void CreateDatePickerDialog(int year, int month, int day)
        {
            CustomDatePicker view = Element;

            _dialog = new DatePickerDialog(Context, (o, e) =>
            {
                view.Date = e.Date;
                ((IElementController)view).SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
                Control.ClearFocus();

                _dialog = null;
            }, year, month, day);

            _dialog.SetButton("Done", (sender, e) =>
            {
                this.ClearFocus();
                SetDate(_dialog.DatePicker.DateTime);
                this.Element.Format = this.Element.OriginalFormat;
                this.Element.AssignValue();
                Control.Parent.RequestLayout();

                _dialog = null;
            });
            _dialog.SetButton2("Clear", (sender, e) =>
            {
                this.ClearFocus();
                this.Element.ClearDate();
                Control.Text = this.Element.PlaceHolder;
                Control.Invalidate();
                Control.RequestLayout();
                Control.ForceLayout();

                _dialog = null;
            });
        }
Ejemplo n.º 7
0
        void CreateDatePickerDialog(int year, int month, int day)
        {
            CustomDatePicker view = Element;

            _dialog = new DatePickerDialog(Context, callBack: (o, e) =>
            {
                view.Date = e.Date;
                ((IElementController)view).SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
                Control.ClearFocus();

                _dialog = null;
            }, year: year, monthOfYear: month, dayOfMonth: day);

            //Show Done button by default
            _dialog.SetButton("Done", (sender, e) =>
            {
                SetDate(_dialog.DatePicker.DateTime);
                this.Element.Format = this.Element._originalFormat;
                this.Element.AssignValue();
            });
            if (this.Element.ShowClearButton)
            {
                _dialog.SetButton2("Cancel", (sender, e) =>
                {
                    this.Element.Cancel();
                    Control.Text = this.Element.Format;
                });

                _dialog.SetButton3("Remove Date", (sender, e) =>
                {
                    this.Element.CleanDate();
                    Control.Text = this.Element.Format;
                });
            }
            else  //Show Cancel button by default
            {
                _dialog.SetButton2("Cancel", (sender, e) =>
                {
                    this.Element.Cancel();
                    Control.Text = this.Element.Format;
                });
            }
        }
Ejemplo n.º 8
0
 //METHOD: Create dialog for Date Picker.
         #pragma warning disable
 protected override Dialog OnCreateDialog(int id)
 {
         #pragma warning restore
     DatePickerDialog dpd = new DatePickerDialog(this, HandleDateSet, todays_date.Year,
                                                 todays_date.Month - 1, todays_date.Day);
     dpd.SetMessage("Requests issued within 2 days will add a $15.00 fee.");
     dpd.SetIcon(Resource.Drawable.ic_action_time);
     dpd.SetCanceledOnTouchOutside(false);
     dpd.SetCancelable(false);
                 #pragma warning disable
     dpd.SetButton("Cancel", dpd);
     dpd.SetButton2("Confirm", dpd);
                 #pragma warning restore
     return(dpd);
 }
Ejemplo n.º 9
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            if (this.Date == null)
            {
                this.Date = DateTime.Now;
            }
            DatePickerDialog dialog = new DatePickerDialog(Activity,
                                                           this,
                                                           this.Date.Value.Year,
                                                           this.Date.Value.Month,
                                                           this.Date.Value.Day);

            dialog.SetButton("Ok", OnOkEventHandling);
            dialog.SetButton2("Kein Datum", OnCancelEventHandling);

            return(dialog);
        }
Ejemplo n.º 10
0
        protected override DatePickerDialog CreateDatePickerDialog(int year, int month, int day)
        {
            var view   = BaseElement;
            var dialog = new DatePickerDialog(Context, (o, e) =>
            {
                view.Date = e.Date;
                ((IElementController)view).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
            }, year, month, day);

            dialog.SetButton2("Clear", (sender, e) =>
            {
                view.Date         = DateTime.Now;
                view.NullableDate = null;
                ((IElementController)view).SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
            });

            return(dialog);
        }
Ejemplo n.º 11
0
        void CreateDatePickerDialog(int year, int month, int day)
        {
            DatePickerXamDisableDates.DatePickerRender view = Element;
            _dialog = new DatePickerDialog(Context, (o, e) =>
            {
                view.Date = e.Date;
                ((IElementController)view).SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
                Control.ClearFocus();

                _dialog = null;
            }, year, month, day);



            var languageDevice = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName;

            var done   = "تم";
            var cancel = "إلغاء";
            var clear  = "إعادة";

            if (languageDevice.ToLower().Contains("en"))
            {
                done   = "Done";
                cancel = "Cancel";
                clear  = "Clear";
            }
            _dialog.SetButton(done, (sender, e) =>
            {
                SetDate(_dialog.DatePicker.DateTime);
                this.Element.Format = this.Element._originalFormat;
                this.Element.AssignValue();
                // App.DateSelected = _dialog.DatePicker.DateTime;
            });

            _dialog.SetButton2(cancel, (sender, e) =>
            {
            });
            _dialog.SetButton3(clear, (sender, e) =>
            {
                this.Element.CleanDate();
                Control.Text = this.Element.Format;
                //App.DateSelected = default(DateTime);
            });
        }
Ejemplo n.º 12
0
        void CreateDatePickerDialog(int year, int month, int day)
        {
            GodAndMe.NullableDatePicker view = Element;
            _dialog = new DatePickerDialog(Context, (o, e) =>
            {
                view.Date = e.Date;
                ((IElementController)view).SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
                Control.ClearFocus();

                _dialog = null;
            }, year, month, day);

            _dialog.SetButton(CommonFunctions.i18n("Done"), (sender, e) =>
            {
                SetDate(_dialog.DatePicker.DateTime);
                this.Element.Format = this.Element._originalFormat;
                this.Element.AssignValue();
            });
            _dialog.SetButton2(CommonFunctions.i18n("Clear"), (sender, e) =>
            {
                this.Element.CleanDate();
                Control.Text = this.Element.Format;
            });
        }
Ejemplo n.º 13
0
        void CreateDatePickerDialog(int year, int month, int day)
        {
            BioDivCollectorXamarin.Controls.CustomDatePicker view = Element;
            _dialog = new DatePickerDialog(Context, (o, e) =>
            {
                view.Date = e.Date;
                ((IElementController)view).SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
                Control.ClearFocus();

                _dialog = null;
            }, year, month, day);

            _dialog.SetButton("Fertig", (sender, e) =>
            {
                SetDate(_dialog.DatePicker.DateTime);
                this.Element.Format = this.Element._originalFormat;
                this.Element.AssignValue();
            });
            _dialog.SetButton2("Löschen", (sender, e) =>
            {
                this.Element.CleanDate();
                Control.Text = this.Element.Format;
            });
        }