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

CalendarMonthView() public method

public CalendarMonthView ( System.DateTime selectedDate, bool showHeader, float width = 320 ) : System
selectedDate System.DateTime
showHeader bool
width float
return System
        public CalendarMonthView( DateTime selectedDate, bool showHeader, float width = 320 )
        {
            if (Math.Abs(width - 320) < 0.1)
                width = (float) UIScreen.MainScreen.Bounds.Size.Width;
            this.width = width;
            this.showHeader = showHeader;

            if (showHeader)
                headerHeight = 20;

            BoxWidth = Convert.ToInt32(Math.Ceiling(width/7)) - (int) Math.Ceiling(2*HorizontalPadding/7.0);

            int height = BoxHeight*LinesCount + 2*VerticalPadding + 10;

            // Calendar view frame (header, calendar, paddings).
            Frame = showHeader ? new RectangleF(0, 0, width, height + headerHeight) : new RectangleF(0, 0, width, height);

            BackgroundColor = UIColor.White;
            ClipsToBounds = true;

            CurrentSelectedDate = selectedDate;
            CurrentDate = DateTime.Now.Date;
            CurrentMonthYear = new DateTime(CurrentSelectedDate.Year, CurrentSelectedDate.Month, 1);

            // Actions on swipe.
            var swipeLeft = new UISwipeGestureRecognizer(MonthViewSwipedLeft) {
                Direction = UISwipeGestureRecognizerDirection.Left
            };
            AddGestureRecognizer(swipeLeft);

            var swipeRight = new UISwipeGestureRecognizer(MonthViewSwipedRight) {
                Direction = UISwipeGestureRecognizerDirection.Right
            };
            AddGestureRecognizer(swipeRight);

            var swipeUp = new UISwipeGestureRecognizer(MonthViewSwipedUp) {
                Direction = UISwipeGestureRecognizerDirection.Up
            };
            AddGestureRecognizer(swipeUp);
        }