private void UpdateItemsSource() { if (_calendarViewModel.ShowPastCompleteItemsOnFullCalendar) { _itemsControl.ItemsSource = HomeworksOnDay.Get(_allItems, Date); } else { _itemsControl.ItemsSource = HomeworksOnDay.Get(_allItems, Date, today: _calendarViewModel.Today, activeOnly: true); } }
public MainCalendarSquare(MainCalendarGrid calendarGrid, DateTime date, MyObservableList<BaseViewItemHomeworkExamGrade> allItems) : base(calendarGrid, date) { // Render is called before this AllowDrop = true; DragOver += MainCalendarSquare_DragOver; Drop += MainCalendarSquare_Drop; _itemsControl.ItemsSource = HomeworksOnDay.Get(allItems, date); _holidays = HolidaysOnDay.Create(allItems, date); _holidays.CollectionChanged += new WeakEventHandler<NotifyCollectionChangedEventArgs>(delegate { UpdateIsHoliday(); }).Handler; UpdateIsHoliday(); }
private void OnDateChanged() { _title.Text = GetHeaderText(Date); _tableViewSource.Items = HomeworksOnDay.Get(SemesterItems.Items, Date); _scheduleSnapshot.Initialize(SemesterItems, Date); // Make sure we always start at the top, otherwise past recycled views might be scrolled down further _items.SetContentOffset(new CGPoint(), animated: false); UpdateIsDifferentSemester(); }
private void UpdateDay() { if (smallCalendar.SelectedDate == null) { return; } var date = smallCalendar.SelectedDate.Value; setHeaderText(date); listHeader.DateToUseForNewItems = date; scheduleSnapshot.Initialize(_viewModel.SemesterItemsViewGroup, date); listControl.ItemsSource = HomeworksOnDay.Get(_viewModel.SemesterItemsViewGroup.Items, date); }
public void Initialize(DateTime date, HomeworksOnDay homeworks, SemesterItemsViewGroup viewGroup) { _viewItemsGroup = viewGroup; _date = date; // Set the header text FindViewById <TextView>(Resource.Id.TextViewHeaderText).Text = GetHeaderText(date); if (_currItemsSourceCollectionChangedHandler != null && _adapter.ItemsSource is INotifyCollectionChanged) { (_adapter.ItemsSource as INotifyCollectionChanged).CollectionChanged -= _currItemsSourceCollectionChangedHandler; } _adapter.ItemsSource = homeworks; _currItemsSourceCollectionChangedHandler = new WeakEventHandler <NotifyCollectionChangedEventArgs>(ItemsSource_CollectionChanged).Handler; homeworks.CollectionChanged += _currItemsSourceCollectionChangedHandler; InitializeDifferentSemesterOverlay(); InitializeSnapshot(); }
public override Java.Lang.Object InstantiateItem(ViewGroup container, int position) { DateTime date = GetDate(position); var homeworksOnDay = HomeworksOnDay.Get(ItemsSource.Items, date); SingleDayControl control = _destroyedControls.FirstOrDefault(); if (control != null) { _destroyedControls.Remove(control); try { control.Initialize(date, homeworksOnDay, ItemsSource); } // ObjectDisposedException actually shouldn't ever occur here. If it does, we should analyze why. catch (Exception ex) { TelemetryExtension.Current?.TrackException(ex); } // So we'll fall back to creating a new one control = null; } if (control == null) { control = new SingleDayControl(container); control.ItemClick += SingleDayControl_ItemClick; control.HolidayItemClick += SingleDayControl_HolidayItemClick; control.ScheduleItemClick += SingleDayControl_ScheduleItemClick; control.ScheduleClick += SingleDayControl_ScheduleClick; control.Initialize(date, homeworksOnDay, ItemsSource); } container.AddView(control); return(control); }
public SingleDayView(DayViewModel calendar, DateTime date) { this.InitializeComponent(); Date = date; _today = calendar.Today; _viewModel = calendar; setHeaderText(date); listHeader.DateToUseForNewItems = date; listHeader.Classes = calendar.SemesterItemsViewGroup.Classes; scheduleSnapshot.Initialize(calendar.SemesterItemsViewGroup, date); listControl.ItemsSource = HomeworksOnDay.Get(calendar.SemesterItemsViewGroup.Items, date); var semester = calendar.SemesterItemsViewGroup.Semester; if (semester != null && !semester.IsDateDuringThisSemester(date)) { RootGrid.Children.Add(new DifferentSemesterOverlayControl()); } }
public override IEnumerable GetItemsSource(DateTime date) { return(HomeworksOnDay.Get(_semesterItems.Items, date) .Sublist(i => (i is BaseViewItemHomeworkExam) && !(i as BaseViewItemHomeworkExam).IsComplete())); }