protected override void OnParametersSet()
        {
            if (_oldType != DateType)
            {
                UpdateSetting("mode", DateType.ToString().ToLower());
                _oldType = DateType;
            }

            base.OnParametersSet();
        }
        public async Task ShowPicker(DatePickerType type, string targetElementID)
        {
            if (Stub != null)
            {
                switch (type)
                {
                case DatePickerType.Decade:
                    await Stub.ShowDecadePicker(targetElementID);

                    break;

                case DatePickerType.Year:
                    await Stub.ShowYearPicker(targetElementID);

                    break;

                case DatePickerType.Month:
                    await Stub.ShowMonthPicker(targetElementID);

                    break;

                case DatePickerType.Week:
                    await Stub.ShowWeekPicker(targetElementID);

                    break;

                case DatePickerType.Date:
                    await Stub.ShowDatePicker(targetElementID);

                    break;

                default:
                    break;
                }
            }
        }
        private void PresentDatePicker(UITextField sender, DatePickerType pickerType, string pickerTitle, UIColor pickerTitleColor)
	    {
            DateTime selectedTime = DateTime.Parse(sender.Text);
            NSDate selectedDate = DateTimeToNSDate(selectedTime);

            var modalPicker = new ModalPickerViewController(ModalPickerType.Date, pickerTitle.Localize(), this)
            {
                HeaderBackgroundColor = pickerTitleColor,
                HeaderTextColor = UIColor.White,
                TransitioningDelegate = new ModalPickerTransitionDelegate(),
                ModalPresentationStyle = UIModalPresentationStyle.Custom
            };
            modalPicker.DatePicker.Date = selectedDate;

            modalPicker.OnModalPickerDismissed += (o, args) =>
            {
                DateTime utcDateTime = NSDateToDateTime(modalPicker.DatePicker.Date);
                if (pickerType == DatePickerType.StartDate)
                {
                    Event.StartDate = utcDateTime;
                }
                else if (pickerType == DatePickerType.EndDate)
                {
                    Event.EndDate = utcDateTime;
                }
                DateTime localDateTime = utcDateTime.ToLocalTime();
                sender.Text = localDateTime.ToShortDateString() + " " + localDateTime.ToShortTimeString();
            };
            PresentViewController(modalPicker, true, null);
	    }
 /// <summary>
 ///
 /// </summary>
 public virtual TBuilder Type(DatePickerType type)
 {
     this.ToComponent().Type = type;
     return(this as TBuilder);
 }
Esempio n. 5
0
 public static IElement <DatePicker> Type(this IElement <DatePicker> element, DatePickerType type) => element.Attribute("type", type);