public void OnClick(object sender, EventArgs e)
        {
            HideKeyboard();
            _dialog = new TimePickerDialog(Context, this, blankPicker.Time.Hours, blankPicker.Time.Minutes, true);

            _dialog.SetButton(blankPicker.DoneButtonText, (k, p) => { });
            _dialog.SetButton2(blankPicker.CancelButtonText, (k, p) =>
            {
                EController.SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
                Control.ClearFocus();
                HideKeyboard();
                blankPicker.SendCancelClicked();
            });

            _dialog.CancelEvent += _dialog_DismissEvent;

            _dialog.Show();
        }
Пример #2
0
        void CreateTimePickerDialog(int hours, int minutes)
        {
            NullableTimePicker view = Element;

            _dialog = new TimePickerDialog(Context, (o, e) =>
            {
                view.Time = new TimeSpan(hours: e.HourOfDay, minutes: e.Minute, seconds: 0);
                view.AssignValue();
                ((IElementController)view).SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
                Control.ClearFocus();

                _dialog = null;
            }, hours, minutes, true);

            _dialog.SetButton2("clear", (sender, e) =>
            {
                this.Element.CleanTime();
                Control.Text = this.Element.Format;
            });
        }
Пример #3
0
        public void OnPickerClick(object sender, EventArgs e)
        {
            _dialog = new TimePickerDialog(Context, (s, d) =>
            {
                EController.SetValueFromRenderer(Xamarin.Forms.TimePicker.TimeProperty, new TimeSpan(d.HourOfDay, d.Minute, 0));
                EController.SetValueFromRenderer(VisualElement.IsFocusedPropertyKey, false);
                Control.ClearFocus();

                _dialog = null;
            }, this.Element.Time.Hours, this.Element.Time.Minutes, true);

            _dialog.SetButton(blankPicker.CancelButtonText, (s, el) =>
            {
                blankPicker.SendCancelClicked();
            });
            _dialog.SetButton2(blankPicker.DoneButtonText, (k, p) =>
            {
                this.Control.Text = Element.Time.ToString(Element.Format);
                blankPicker.SendDoneClicked();
            });
            _dialog.Show();
        }