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

RebuildGrid() public method

Rebuild month grid.
public RebuildGrid ( bool right, bool animated ) : void
right bool Direction of the transition.
animated bool Animate transition.
return void
        public void RebuildGrid( bool right, bool animated )
        {
            UserInteractionEnabled = false;

            // Get new month grid.
            MonthGridView gridToMove = CreateNewGrid(CurrentMonthYear);
            nfloat pointsToMove = (right ? Frame.Width : -Frame.Width);

            gridToMove.Frame = new RectangleF(new PointF((float) pointsToMove, VerticalPadding/2.0f), (SizeF) gridToMove.Frame.Size);

            scrollView.AddSubview(gridToMove);

            if (animated) {
                BeginAnimations("changeMonth");
                SetAnimationDuration(0.4);
                SetAnimationDelay(0.1);
                SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
            }

            monthGridView.Center = new PointF((float) (monthGridView.Center.X - pointsToMove), (float) monthGridView.Center.Y);
            gridToMove.Center = new PointF((float) (gridToMove.Center.X - pointsToMove + HorizontalPadding), (float) gridToMove.Center.Y);

            monthGridView.Alpha = 0;

            SetNeedsDisplay();

            if (animated)
                CommitAnimations();

            monthGridView = gridToMove;

            UserInteractionEnabled = true;

            if (MonthChanged != null)
                MonthChanged(CurrentMonthYear);
        }