Example #1
0
        static void DrawCalendarDay(SKCanvas canvas, SKPaint textPaint, SKPaint paint, SKPath path, CalendarDayModel calendarDay)
        {
            var rect = calendarDay.Rectangle;
            var date = calendarDay.DateTime;

            var x      = rect.Left;
            var y      = rect.Top;
            var width  = rect.Width;
            var height = rect.Height;

            DrawRectangleOutline(canvas, paint, path, x, y, width, height);

            if (calendarDay.IsHighlighted)
            {
                DrawRectangle(canvas, paint, x, y, width, height);
            }

            DrawText(canvas, textPaint,
                     text: date.Day.ToString(),
                     x: x + (width / 2), y: y + (height / 2) + (height / 8),
                     fontSize: (int)(width / 3));
        }
Example #2
0
        static void DrawCalendarDay(SKCanvas canvas, SKPaint textPaint, SKPaint paint, SKPath path, CalendarDayModel calendarDay, bool isTargetMonth)
        {
            var rect = calendarDay.Rectangle;
            var date = calendarDay.DateTime;

            var x      = rect.Left;
            var y      = rect.Top;
            var width  = rect.Width;
            var height = rect.Height;

            DrawRectangleOutline(canvas, paint, path, x, y, width, height);

            string text;

            if (!string.IsNullOrEmpty(calendarDay.Description))
            {
                text            = calendarDay.Description;
                textPaint.Color = SKColor.Parse("#4E9AF5");
            }
            else
            {
                text = date.Day.ToString();

                if (calendarDay.Type != null)
                {
                    var adjusted_x = x + (width * .125f);
                    var adjusted_y = y + (height * .125f);

                    var adjusted_width  = width * .75f;
                    var adjusted_height = height * .75f;

                    if (calendarDay.Type == HighlightType.Dark)
                    {
                        paint.Color     = SKColor.Parse("#55C433");
                        textPaint.Color = SKColors.White;
                    }
                    else
                    {
                        paint.Color     = SKColor.Parse("#E5F6DB");
                        textPaint.Color = SKColor.Parse("#737387");
                    }

                    DrawRectangle(canvas, paint, adjusted_x, adjusted_y, adjusted_width, adjusted_height);
                }
                else if (!isTargetMonth)
                {
                    textPaint.Color = SKColor.Parse("#DCDEDF");
                }
                else
                {
                    textPaint.Color = SKColor.Parse("#737387");
                }
            }

            DrawText(canvas, textPaint,
                     text: text,
                     x: x + (width / 2), y: y + (height / 2) + (height / 8),
                     fontSize: (int)(width / 3));
        }