Exemplo n.º 1
0
            public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
            {
                DateTime date = GetDate(position);

                var tasksOrEventsOnDay = TasksOrEventsOnDay.Get(Account, ItemsSource.Items, date);

                (holder.ItemView as SingleDayControl).Initialize(date, tasksOrEventsOnDay, ItemsSource);
            }
Exemplo n.º 2
0
 private void UpdateItemsSource()
 {
     if (_calendarViewModel.ShowPastCompleteItemsOnFullCalendar)
     {
         _itemsControl.ItemsSource = TasksOrEventsOnDay.Get(_calendarViewModel.MainScreenViewModel.CurrentAccount, _allItems, Date);
     }
     else
     {
         _itemsControl.ItemsSource = TasksOrEventsOnDay.Get(_calendarViewModel.MainScreenViewModel.CurrentAccount, _allItems, Date, today: _calendarViewModel.Today, activeOnly: true);
     }
 }
        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 = TasksOrEventsOnDay.Get(_viewModel.SemesterItemsViewGroup.Items, date);
        }
Exemplo n.º 4
0
        public void Initialize(DateTime date, TasksOrEventsOnDay tasksOrEvents, 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 = tasksOrEvents;
            _currItemsSourceCollectionChangedHandler = new WeakEventHandler <NotifyCollectionChangedEventArgs>(ItemsSource_CollectionChanged).Handler;
            tasksOrEvents.CollectionChanged         += _currItemsSourceCollectionChangedHandler;

            InitializeDifferentSemesterOverlay();
            InitializeSnapshot();
        }
Exemplo n.º 5
0
            public override Java.Lang.Object InstantiateItem(ViewGroup container, int position)
            {
                DateTime date = GetDate(position);

                var tasksOrEventsOnDay = TasksOrEventsOnDay.Get(ItemsSource.Items, date);

                SingleDayControl control = _destroyedControls.FirstOrDefault();

                if (control != null)
                {
                    _destroyedControls.Remove(control);

                    try
                    {
                        control.Initialize(date, tasksOrEventsOnDay, 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, tasksOrEventsOnDay, ItemsSource);
                }

                container.AddView(control);

                return(control);
            }
Exemplo n.º 6
0
        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 = TasksOrEventsOnDay.Get(calendar.MainScreenViewModel.CurrentAccount, calendar.SemesterItemsViewGroup.Items, date);

            var semester = calendar.SemesterItemsViewGroup.Semester;

            if (semester != null && !semester.IsDateDuringThisSemester(date))
            {
                RootGrid.Children.Add(new DifferentSemesterOverlayControl());
            }
        }