/// <summary> /// Rebuild month grid. /// </summary> /// <param name="right">Direction of the transition.</param> /// <param name="animated">Animate transition.</param> 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); } }
private void LoadInitialGrids() { monthGridView = CreateNewGrid(CurrentMonthYear); }
/// <summary> /// Create new month grid. /// </summary> /// <param name="date">Needed month.</param> /// <returns>Return new calendar month grid view.</returns> private MonthGridView CreateNewGrid( DateTime date ) { var grid = new MonthGridView(this, date) {CurrentDate = CurrentDate}; grid.BuildGrid(); grid.Frame = new RectangleF(HorizontalPadding, VerticalPadding/2.0f, width - HorizontalPadding, (float) Frame.Height - 16); return grid; }
/// <summary> /// Rebuild month grid. /// </summary> /// <param name="right">Direction of the transition.</param> /// <param name="animated">Animate transition.</param> 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); }