private bool SelectDayView(UITouch touch)
{
var p = touch.LocationInView(this);
int index = ((int)p.Y / 44) * 7 + ((int)p.X / 46);
if (index < 0 || index >= _dayTiles.Count)
{
return(false);
}
var newSelectedDayView = _dayTiles[index];
if (newSelectedDayView == SelectedDayView)
{
return(false);
}
if (!newSelectedDayView.Active && touch.Phase != UITouchPhase.Moved)
{
var day = int.Parse(newSelectedDayView.Text);
if (day > 15)
{
_calendarMonthView.MoveCalendarMonths(false, true);
}
else
{
_calendarMonthView.MoveCalendarMonths(true, true);
}
return(false);
}
else if (!newSelectedDayView.Active && !newSelectedDayView.Available)
{
return(false);
}
if (SelectedDayView != null)
{
SelectedDayView.Selected = false;
}
this.BringSubviewToFront(newSelectedDayView);
newSelectedDayView.Selected = true;
SelectedDayView = newSelectedDayView;
SetNeedsDisplay();
return(true);
}