TodoApp.iOS.Controls.CalendarMonthView.MoveCalendarMonths C# (CSharp) Method

MoveCalendarMonths() public method

Change calendar month.
public MoveCalendarMonths ( bool right, bool animated ) : void
right bool Direction of the transition.
animated bool Animate transition.
return void
        public void MoveCalendarMonths( bool right, bool animated )
        {
            CurrentMonthYear = CurrentMonthYear.AddMonths(right ? 1 : -1);
            RebuildGrid(right, animated);
        }

Usage Example

Example #1
0
        private bool SelectDayView(PointF p)
        {
            int index = ((int)p.Y / calendarMonthView.BoxHeight) * 7 + ((int)p.X / calendarMonthView.BoxWidth);

            if (index < 0 || index >= dayTiles.Count)
            {
                return(false);
            }

            CalendarDayView newSelectedDayView = dayTiles[index];

            if (newSelectedDayView == SelectedDayView)
            {
                return(false);
            }

            if (!newSelectedDayView.Active)
            {
                int day = int.Parse(newSelectedDayView.Text);
                if (day > 15)
                {
                    calendarMonthView.MoveCalendarMonths(false, true);
                }
                else
                {
                    calendarMonthView.MoveCalendarMonths(true, true);
                }
                return(false);
            }
            if (!newSelectedDayView.Active && !newSelectedDayView.Available)
            {
                return(false);
            }

            if (SelectedDayView != null)
            {
                SelectedDayView.Selected = false;
            }

            BringSubviewToFront(newSelectedDayView);
            newSelectedDayView.Selected = true;

            SelectedDayView = newSelectedDayView;
            calendarMonthView.CurrentSelectedDate = SelectedDayView.Date;
            SetNeedsDisplay();
            return(true);
        }