Exemplo n.º 1
0
		/// <summary>
		/// Initializes a new instance of the <see cref="MonthAdapter"/> class.
		/// </summary>
		/// <param name="context">The context.</param>
		/// <param name="calendar">The calendar.</param>
		public MonthAdapter(Context context, CalendarPickerView calendar)
		{
			_calendar = calendar;
			_inflater = LayoutInflater.From(context);
			_activeMonthViews = new Dictionary<int, MonthView>();

		}
Exemplo n.º 2
0
        /// <summary>
        /// Withes the selected dates.
        /// </summary>
        /// <param name="selectedDates">The selected dates.</param>
        /// <returns>FluentInitializer.</returns>
        /// <exception cref="Java.Lang.IllegalArgumentException">SINGLE mode can't be used with multiple selectedDates</exception>
        public FluentInitializer WithSelectedDates(ICollection <DateTime> selectedDates)
        {
            if (_calendar.Mode == CalendarPickerView.SelectionMode.Single && _calendar.SelectedDates.Count > 1)
            {
                throw new IllegalArgumentException("SINGLE mode can't be used with multiple selectedDates");
            }
            if (_calendar.SelectedDates != null)
            {
                foreach (var date in selectedDates)
                {
                    _calendar.SelectDate(date);
                }
            }
            int selectedIndex = -1;
            int todayIndex    = -1;

            for (int i = 0; i < _calendar.Months.Count; i++)
            {
                var month = _calendar.Months[i];
                if (selectedIndex == -1)
                {
                    if (_calendar.SelectedCals.Any(
                            selectedCal => CalendarPickerView.IsSameMonth(selectedCal, month)))
                    {
                        selectedIndex = i;
                    }
                    if (selectedIndex == -1 && todayIndex == -1 &&
                        CalendarPickerView.IsSameMonth(DateTime.Now, month))
                    {
                        todayIndex = i;
                    }
                }
            }
            if (selectedIndex != -1)
            {
                _calendar.ScrollToSelectedMonth(selectedIndex);
            }
            else if (todayIndex != -1)
            {
                _calendar.ScrollToSelectedMonth(todayIndex);
            }

            _calendar.ValidateAndUpdate();
            return(this);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OnPageChangeListener"/> class.
 /// </summary>
 /// <param name="picker">The picker.</param>
 public OnPageChangeListener(CalendarPickerView picker)
 {
     this._picker = picker;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FluentInitializer"/> class.
 /// </summary>
 /// <param name="calendar">The calendar.</param>
 public FluentInitializer(CalendarPickerView calendar)
 {
     _calendar = calendar;
 }
		/// <summary>
		/// Ins the mode.
		/// </summary>
		/// <param name="mode">The mode.</param>
		/// <returns>FluentInitializer.</returns>
		public FluentInitializer InMode(CalendarPickerView.SelectionMode mode)
		{
			_calendar.Mode = mode;
			_calendar.ValidateAndUpdate();
			return this;
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="FluentInitializer"/> class.
		/// </summary>
		/// <param name="calendar">The calendar.</param>
		public FluentInitializer(CalendarPickerView calendar)
		{
			_calendar = calendar;
		}
			/// <summary>
			/// Initializes a new instance of the <see cref="OnPageChangeListener"/> class.
			/// </summary>
			/// <param name="picker">The picker.</param>
			public OnPageChangeListener(CalendarPickerView picker)
			{
				this._picker = picker;

			}
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MonthAdapter"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="calendar">The calendar.</param>
 public MonthAdapter(Context context, CalendarPickerView calendar)
 {
     _calendar         = calendar;
     _inflater         = LayoutInflater.From(context);
     _activeMonthViews = new Dictionary <int, MonthView>();
 }