private static void OnSundayBackgroundColorChanged(BindableObject bindable, object oldValue, object newValue)
        {
            CalendarDayView thisctrl = (CalendarDayView)bindable;

            if (thisctrl != null && oldValue != newValue)
            {
                //thisctrl.SundayBackgroundColor = (Color)newValue;
            }
        }
        private static void OnGridDimChanged(BindableObject bindable, object oldValue, object newValue)
        {
            CalendarDayView thisctrl = (CalendarDayView)bindable;

            if (thisctrl != null && oldValue != newValue)
            {
                thisctrl.dayToday.HeightRequest = (double)newValue;
            }
        }
        private static void OnSaturdayBackgroundOpacityChanged(BindableObject bindable, object oldValue, object newValue)
        {
            CalendarDayView thisctrl = (CalendarDayView)bindable;

            if (thisctrl != null && oldValue != newValue)
            {
                //thisctrl.SaturdayBackgroundOpacity = (double)newValue;
            }
        }
        private static void OnNotInCurrentMonthOpacityChanged(BindableObject bindable, object oldValue, object newValue)
        {
            CalendarDayView thisctrl = (CalendarDayView)bindable;

            if (thisctrl != null && oldValue != newValue)
            {
                //thisctrl.NotInCurrentMonthOpacity = (double)newValue;
            }
        }
        private static void OnSelectedDateBackgroundColorChanged(BindableObject bindable, object oldValue, object newValue)
        {
            CalendarDayView thisctrl = (CalendarDayView)bindable;

            if (thisctrl != null && oldValue != newValue)
            {
                thisctrl.BackgroundColor = thisctrl.IsSelected ? thisctrl.SelectedDateBackgroundColor : Color.Transparent;
            }
        }
        private static void OnTodayColorChanged(BindableObject bindable, object oldValue, object newValue)
        {
            CalendarDayView thisctrl = (CalendarDayView)bindable;

            if (thisctrl != null && oldValue != newValue)
            {
                thisctrl.calendarDay.TextColor = (Color)newValue;
            }
        }
Exemplo n.º 7
0
        private static void OnHorizLayoutChanged(BindableObject bindable, object oldValue, object newValue)
        {
            CalendarDayView thisctrl = (CalendarDayView)bindable;

            if (thisctrl != null && oldValue != newValue)
            {
                thisctrl.calendarDay.HorizontalOptions = (LayoutOptions)newValue;
            }
        }
        private static void OnNotCurrentMonthTextColorChanged(BindableObject bindable, object oldValue, object newValue)
        {
            CalendarDayView thisctrl = (CalendarDayView)bindable;

            if (thisctrl != null && oldValue != newValue)
            {
                //thisctrl.NotCurrentMonthTextColor = (Color)newValue;
            }
        }
Exemplo n.º 9
0
        private static void OnCalendarDayPaddingChanged(BindableObject bindable, object oldValue, object newValue)
        {
            CalendarDayView thisctrl = (CalendarDayView)bindable;

            if (thisctrl != null && oldValue != newValue)
            {
                thisctrl.calendarDay.Padding = (Thickness)newValue;
            }
        }
Exemplo n.º 10
0
        private static void OnCurrentMonthChanged(BindableObject bindable, object oldValue, object newValue)
        {
            CalendarDayView thisctrl = (CalendarDayView)bindable;

            if (thisctrl != null && oldValue != newValue)
            {
                ResetGridDateDisplay(thisctrl, thisctrl.CalendarDate, (int)newValue);
            }
        }
Exemplo n.º 11
0
        private static void OnEventsChanged(BindableObject bindable, object oldValue, object newValue)
        {
            CalendarDayView thisctrl = (CalendarDayView)bindable;

            if (thisctrl != null && oldValue != newValue)
            {
                ObservableCollection <ICalendarEvent> lst = (ObservableCollection <ICalendarEvent>)newValue;
                BindableLayout.SetItemsSource(thisctrl.flexLayout, lst);
            }
        }
Exemplo n.º 12
0
        private static void OnCalendarDayFontSizeChanged(BindableObject bindable, object oldValue, object newValue)
        {
            CalendarDayView thisctrl = (CalendarDayView)bindable;

            if (thisctrl != null && oldValue != newValue)
            {
                FontSizeConverter fsc   = new FontSizeConverter();
                double            fsize = (double)fsc.ConvertFromInvariantString((string)newValue);
                thisctrl.calendarDay.FontSize = fsize;
            }
        }
Exemplo n.º 13
0
        private static void OnCalendarDateChanged(BindableObject bindable, object oldValue, object newValue)
        {
            CalendarDayView thisctrl = (CalendarDayView)bindable;

            if (thisctrl != null && oldValue != newValue)
            {
                DateTime?result = (DateTime?)newValue;
                thisctrl.calendarDay.Text = result.HasValue ? result.Value.Day.ToString() : null;
                ResetGridDateDisplay(thisctrl, result, thisctrl.CurrentMonth);
            }
        }
Exemplo n.º 14
0
        private static void ResetGridDateDisplay(CalendarDayView thisctrl, DateTime?dt, int monthNdx)
        {
            if (dt.HasValue)
            {
                thisctrl.calendarDay.TextColor       = thisctrl.DefaultColor;
                thisctrl.calendarDay.BackgroundColor = Color.Transparent;
                thisctrl.BackgroundColor             = Color.Transparent;
                if (dt.Value.Date == DateTime.Today)
                {
                    thisctrl.calendarDay.TextColor       = thisctrl.TodayColor;
                    thisctrl.calendarDay.BackgroundColor = thisctrl.TodayBackgroundColor;
                }
                else
                {
                    if (thisctrl.CalendarDate.Value.DayOfWeek == DayOfWeek.Saturday)
                    {
                        thisctrl.calendarDay.TextColor       = thisctrl.SaturdayColor;
                        thisctrl.calendarDay.BackgroundColor = thisctrl.SaturdayBackgroundColor;
                    }
                    else if (thisctrl.CalendarDate.Value.DayOfWeek == DayOfWeek.Sunday)
                    {
                        thisctrl.calendarDay.TextColor       = thisctrl.SundayColor;
                        thisctrl.calendarDay.BackgroundColor = thisctrl.SundayBackgroundColor;
                    }
                    else
                    {
                        thisctrl.calendarDay.TextColor       = thisctrl.DefaultColor;
                        thisctrl.calendarDay.BackgroundColor = Color.Transparent;
                    }

                    thisctrl.Opacity = 1.0;
                }

                if (thisctrl.CalendarDate.HasValue)
                {
                    thisctrl.calendarDay.Opacity = 1.0;
                    thisctrl.flexLayout.Opacity  = 1.0;
                    if (!thisctrl.CurrrentDateIsInCurrentMonth(monthNdx + 1))
                    {
                        thisctrl.BackgroundColor = thisctrl.NotCurrentMonthBackgroundColor;
                        thisctrl.Opacity         = thisctrl.NotInCurrentMonthOpacity;
                        if (dt.Value.Date != DateTime.Today)
                        {
                            thisctrl.calendarDay.TextColor = thisctrl.NotCurrentMonthTextColor;
                        }
                        if (thisctrl.HideNonMonthDates)
                        {
                            thisctrl.calendarDay.Opacity = 0.0;
                            thisctrl.flexLayout.Opacity  = 0.0;
                        }
                    }
                    else
                    {
                        //switch (dt.Value.DayOfWeek)
                        //{
                        //case DayOfWeek.Sunday:
                        //    if (dt.Value.Date != DateTime.Today)
                        //    {
                        //        thisctrl.BackgroundColor = thisctrl.SundayBackgroundColor;
                        //        thisctrl.Opacity = thisctrl.SundayBackgroundOpacity;
                        //    }
                        //    else
                        //    {
                        //        //thisctrl.BackgroundColor = thisctrl.TodayBackgroundColor;
                        //        //thisctrl.Opacity = 0.5;
                        //    }
                        //    break;
                        //case DayOfWeek.Saturday:
                        //    if (dt.Value.Date != DateTime.Today)
                        //    {
                        //        thisctrl.BackgroundColor = thisctrl.SaturdayBackgroundColor;
                        //        thisctrl.Opacity = thisctrl.SaturdayBackgroundOpacity;
                        //    }
                        //    else
                        //    {
                        //        //thisctrl.BackgroundColor = thisctrl.TodayBackgroundColor;
                        //        //thisctrl.Opacity = 0.5;
                        //    }
                        //    break;
                        //default:
                        thisctrl.BackgroundColor = Color.Transparent;
                        thisctrl.Opacity         = 1.0;
                        //break;
                        //}
                    }
                }
                else
                {
                    thisctrl.BackgroundColor = thisctrl.NotCurrentMonthBackgroundColor;
                }
            }
            else
            {
                thisctrl.calendarDay.TextColor = thisctrl.DefaultColor;
            }
        }