コード例 #1
0
ファイル: CalendarDay.cs プロジェクト: robocik/BodyArchitect
        public void PopulateDay()
        {
            if (_dayItems != null)
            {
                _dayItems.Children.Clear();

                DateTime startTime = new DateTime(CurrentDate.Year, CurrentDate.Month, CurrentDate.Day, 0, 0, 0);
                for (int i = 0; i < 48; i++)
                {
                    CalendarTimeslotItem timeslot = new CalendarTimeslotItem(Owner);
                    timeslot.StartTime = startTime;
                    timeslot.EndTime   = startTime + TimeSpan.FromMinutes(30);

                    SetTimeslotBackground(timeslot, startTime.Hour);

                    timeslot.SetBinding(CalendarTimeslotItem.StyleProperty, GetOwnerBinding("CalendarTimeslotItemStyle"));
                    _dayItems.Children.Add(timeslot);

                    startTime = startTime + TimeSpan.FromMinutes(30);
                }
            }
            if (Owner != null)
            {
                Owner.ScrollToHome();
            }
        }
コード例 #2
0
ファイル: CalendarDay.cs プロジェクト: robocik/BodyArchitect
 public void SetTimeslotBackground(CalendarTimeslotItem timeslot, int startHour)
 {
     if (!Owner.ShowOffPeekHours || (startHour >= Owner.PeekStartHour && startHour <= Owner.PeekEndHour))
     {
         timeslot.SetBinding(Calendar.BackgroundProperty, GetOwnerBinding("PeakTimeslotBackground"));
     }
     else
     {
         timeslot.SetBinding(Calendar.BackgroundProperty, GetOwnerBinding("OffPeakTimeslotBackground"));
     }
 }