Update() public method

public Update ( ) : void
return void
Exemplo n.º 1
0
 public override void SetNeedsDisplay()
 {
     base.SetNeedsDisplay();
     if (_monthGridView != null)
     {
         _monthGridView.Update();
     }
 }
        public void MoveCalendarMonths(bool upwards, bool animated)
        {
            CurrentMonthYear = CurrentMonthYear.AddMonths(upwards? 1 : -1);
            UserInteractionEnabled = false;

            var gridToMove = CreateNewGrid(CurrentMonthYear);
            var pointsToMove = (upwards? 0 + _monthGridView.Lines : 0 - _monthGridView.Lines) * (Container.Height/5);

            if (upwards && gridToMove.weekdayOfFirst==0)
                pointsToMove += (Container.Height/5);
            if (!upwards && _monthGridView.weekdayOfFirst==0)
                pointsToMove -= (Container.Height/5);

            gridToMove.Frame = new RectangleF(new PointF(0, pointsToMove), gridToMove.Frame.Size);

            _scrollView.AddSubview(gridToMove);

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

            _monthGridView.Center = new PointF(_monthGridView.Center.X, _monthGridView.Center.Y - pointsToMove);
            gridToMove.Center = new PointF(gridToMove.Center.X, gridToMove.Center.Y - pointsToMove);

            _monthGridView.Alpha = 0;

            _scrollView.Frame = new RectangleF(
                           _scrollView.Frame.Location,
                           new SizeF(_scrollView.Frame.Width, (gridToMove.Lines + 1) * (Container.Height/5)));

            _scrollView.ContentSize = _scrollView.Frame.Size;
            SetNeedsDisplay();

            if (animated)
                UIView.CommitAnimations();

            _monthGridView = gridToMove;
            _monthGridView.eventSelected += (evt, rect) => {
                eventSelected(evt, rect);
            };
            _monthGridView.Update();

            UserInteractionEnabled = true;
        }