Пример #1
0
        public void RebuildGrid(bool right, bool animated)
        {
            UserInteractionEnabled = false;

            var gridToMove   = CreateNewGrid(CurrentMonthYear);
            var pointsToMove = (right? Frame.Width : -Frame.Width);

            /*if (left && gridToMove.weekdayOfFirst==0)
             *      pointsToMove += 44;
             * if (!left && _monthGridView.weekdayOfFirst==0)
             *      pointsToMove -= 44;*/

            gridToMove.Frame = new RectangleF(new PointF(pointsToMove, 0), 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 - pointsToMove, _monthGridView.Center.Y);
            gridToMove.Center     = new PointF(gridToMove.Center.X - pointsToMove, gridToMove.Center.Y);

            _monthGridView.Alpha = 0;

            /*_scrollView.Frame = new RectangleF(
             *      _scrollView.Frame.Location,
             *      new SizeF(_scrollView.Frame.Width, this.Frame.Height-16));
             *
             * _scrollView.ContentSize = _scrollView.Frame.Size;*/

            SetNeedsDisplay();

            if (animated)
            {
                UIView.CommitAnimations();
            }

            _monthGridView = gridToMove;

            UserInteractionEnabled = true;

            if (MonthChanged != null)
            {
                MonthChanged(CurrentMonthYear);
            }
        }
        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) * 44;

            if (upwards && gridToMove.weekdayOfFirst == 0)
            {
                pointsToMove += 44;
            }
            if (!upwards && _monthGridView.weekdayOfFirst == 0)
            {
                pointsToMove -= 44;
            }

            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;

            _shadow.Frame = new RectangleF(new PointF(0, gridToMove.Lines * 44 - 88), _shadow.Frame.Size);

            _scrollView.Frame = new RectangleF(
                _scrollView.Frame.Location,
                new SizeF(_scrollView.Frame.Width, (gridToMove.Lines + 1) * 44));

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

            if (animated)
            {
                UIView.CommitAnimations();
            }

            _monthGridView = gridToMove;

            UserInteractionEnabled = true;
        }
Пример #3
0
        private void LoadInitialGrids()
        {
            _monthGridView = CreateNewGrid(CurrentMonthYear);

            /*var rect = _scrollView.Frame;
             * rect.Size = new SizeF { Height = (_monthGridView.Lines + 1) * 44, Width = rect.Size.Width };
             * _scrollView.Frame = rect;*/

            //Frame = new RectangleF(Frame.X, Frame.Y, _scrollView.Frame.Size.Width, _scrollView.Frame.Size.Height+16);

            /*var imgRect = _shadow.Frame;
             * imgRect.Y = rect.Size.Height - 132;
             * _shadow.Frame = imgRect;*/
        }
		private void LoadInitialGrids()
		{
			_monthGridView = CreateNewGrid(CurrentMonthYear);
			
			/*var rect = _scrollView.Frame;
			rect.Size = new SizeF { Height = (_monthGridView.Lines + 1) * 44, Width = rect.Size.Width };
			_scrollView.Frame = rect;*/
			
			//Frame = new RectangleF(Frame.X, Frame.Y, _scrollView.Frame.Size.Width, _scrollView.Frame.Size.Height+16);
			
			/*var imgRect = _shadow.Frame;
			imgRect.Y = rect.Size.Height - 132;
			_shadow.Frame = imgRect;*/
		}
		private MonthGridView CreateNewGrid(DateTime date){
			var grid = new MonthGridView(this, date);
			grid.CurrentDate = CurrentDate;
			grid.BuildGrid();
			grid.Frame = new RectangleF(0, 0, 320, this.Frame.Height-16);
			return grid;
		}
		public void RebuildGrid(bool right, bool animated)
		{
			UserInteractionEnabled = false;
			
			var gridToMove = CreateNewGrid(CurrentMonthYear);
			var pointsToMove = (right? Frame.Width : -Frame.Width);
			
			/*if (left && gridToMove.weekdayOfFirst==0)
				pointsToMove += 44;
			if (!left && _monthGridView.weekdayOfFirst==0)
				pointsToMove -= 44;*/
			
			gridToMove.Frame = new RectangleF(new PointF(pointsToMove, 0), 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 - pointsToMove, _monthGridView.Center.Y);
			gridToMove.Center = new PointF(gridToMove.Center.X  - pointsToMove, gridToMove.Center.Y);
			
			_monthGridView.Alpha = 0;

			/*_scrollView.Frame = new RectangleF(
				_scrollView.Frame.Location,
				new SizeF(_scrollView.Frame.Width, this.Frame.Height-16));
			
			_scrollView.ContentSize = _scrollView.Frame.Size;*/

			SetNeedsDisplay();
			
			if (animated)
				UIView.CommitAnimations();
			
			_monthGridView = gridToMove;
			
			UserInteractionEnabled = true;

			if (MonthChanged != null)
				MonthChanged(CurrentMonthYear);
		}
 private MonthGridView CreateNewGrid(DateTime date)
 {
     var grid = new MonthGridView(this, date, CurrentDate);
     grid.BuildGrid();
     grid.Frame = new RectangleF(0, 0, 320, 400);
     return grid;
 }
        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) * 44;

            if (upwards && gridToMove.weekdayOfFirst==0)
                pointsToMove += 44;
            if (!upwards && _monthGridView.weekdayOfFirst==0)
                pointsToMove -= 44;

            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;

            _shadow.Frame = new RectangleF(new PointF(0, gridToMove.Lines*44-88), _shadow.Frame.Size);

            _scrollView.Frame = new RectangleF(
                           _scrollView.Frame.Location,
                           new SizeF(_scrollView.Frame.Width, (gridToMove.Lines + 1) * 44));

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

            if (animated)
                UIView.CommitAnimations();

            _monthGridView = gridToMove;

            UserInteractionEnabled = true;
        }
        private void LoadInitialGrids()
        {
            _monthGridView = CreateNewGrid(CurrentMonthYear);
            _monthGridView.eventSelected += (evt, rectangle) => {
                eventSelected(evt, rectangle);
            };

            var rect = _scrollView.Frame;
            rect.Size = new SizeF { Height = (_monthGridView.Lines + 1) * (Container.Height/5), Width = rect.Size.Width };
            _scrollView.Frame = rect;

            Frame = new RectangleF(Frame.X, Frame.Y, _scrollView.Frame.Size.Width, _scrollView.Frame.Size.Height+(Container.Height/5));
        }
 private MonthGridView CreateNewGrid(DateTime date)
 {
     var grid = new MonthGridView(this, date);
     grid.CurrentDate = CurrentDate;
     grid.BuildGrid();
     grid.Frame = new RectangleF(0, 0, Container.Width, Container.Height);
     return grid;
 }