예제 #1
0
        private async Task GetEventsForSelectedDate()
        {
            using (new Loading(this))
            {
                var events = await OfficeService.GetCalendarEvents(
                    SelectedDate - TimeSpan.FromDays(1),
                    SelectedDate + TimeSpan.FromDays(1));

                var selectedDateEvents = events.Where(x =>
                                                      x.IsAllDay ?
                                                      x.Start.DateTime.Date.CompareTo(SelectedDate.Date) == 0 :
                                                      x.Start.DateTime.ToLocalTime().Date.CompareTo(SelectedDate.Date) == 0);

                // We use Index property just for visualization
                int index = 0;
                selectedDateEvents.ForEach(ev => ev.Index = index++);

                Meetings = new ObservableCollection <Meeting>(selectedDateEvents);
            }
        }