private bool SelectDayView(PointF p)
{
int index = ((int)p.Y / calendarMonthView.BoxHeight) * 7 + ((int)p.X / calendarMonthView.BoxWidth);
if (index < 0 || index >= dayTiles.Count)
{
return(false);
}
CalendarDayView newSelectedDayView = dayTiles[index];
if (newSelectedDayView == SelectedDayView)
{
return(false);
}
if (!newSelectedDayView.Active)
{
int day = int.Parse(newSelectedDayView.Text);
if (day > 15)
{
calendarMonthView.MoveCalendarMonths(false, true);
}
else
{
calendarMonthView.MoveCalendarMonths(true, true);
}
return(false);
}
if (!newSelectedDayView.Active && !newSelectedDayView.Available)
{
return(false);
}
if (SelectedDayView != null)
{
SelectedDayView.Selected = false;
}
BringSubviewToFront(newSelectedDayView);
newSelectedDayView.Selected = true;
SelectedDayView = newSelectedDayView;
calendarMonthView.CurrentSelectedDate = SelectedDayView.Date;
SetNeedsDisplay();
return(true);
}