예제 #1
0
        private void CalendarDayButton_Click(object sender, RoutedEventArgs e)
        {
            if (LoadingData)
            {
                return;
            }
            var item = (((Button)e.Source).CommandParameter) as CalendarDate;

            if (item != null)
            {
                foreach (var date in CalendarItems)
                {
                    date.IsSelected = false;
                }

                item.IsSelected = true;

                var today = item;

                TodayDate = today.Date;

                var nextDay = CalendarItems.FirstOrDefault(x => x.Date == item.Date.AddDays(1));

                TomorrowDate = nextDay.Date;


                Thread td = new Thread(() => {
                    DisplayTodayItems();

                    DisplayTomorrowItems();
                });
                td.IsBackground = true;
                td.Start();
            }
        }
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     if (this.CalendarItems == null || this.CalendarItems.Count < 1)
     {
         TimeBox.Text = this.Time.Hours.ToString() + ":00";
     }
     else
     {
         TimeSpan time = CalendarItems.FirstOrDefault().Key;
         TimeBox.Text = time.Hours.ToString() + ":" + (time.Minutes < 10 && time.Minutes > 0 ? "0" : "") + time.Minutes.ToString() + (time.Minutes == 0 ? "0" : "");
     }
     ItemBox.Style = this.GridStyle;
     ViewModel     = ((CalendarVm)(MainGrid.DataContext));
 }