Exemplo n.º 1
0
        private void UpdatePresenters(DateTime oldCurrentDate, DateTime newCurrentDate)
        {
            if (this.currentCellsToUpdate == null)
            {
                this.currentCellsToUpdate = new List <CalendarCellModel>();
            }
            else
            {
                this.currentCellsToUpdate.Clear();
            }

            if (oldCurrentDate != DateTime.MinValue && oldCurrentDate != newCurrentDate)
            {
                oldCurrentDate = CalendarMathHelper.GetCellDateForViewLevel(oldCurrentDate, this.Owner.DisplayMode);
                CalendarCellModel previousCell = this.Owner.GetCellByDate(oldCurrentDate);
                if (previousCell != null)
                {
                    previousCell.IsCurrent = false;
                    this.currentCellsToUpdate.Add(previousCell);
                }
            }

            if (newCurrentDate != DateTime.MinValue)
            {
                newCurrentDate = CalendarMathHelper.GetCellDateForViewLevel(newCurrentDate, this.Owner.DisplayMode);
                if (newCurrentDate == oldCurrentDate && this.currentCellsToUpdate.Count > 0)
                {
                    return;
                }

                CalendarCellModel currentCell = this.Owner.GetCellByDate(newCurrentDate);
                if (currentCell != null)
                {
                    currentCell.IsCurrent = true;
                    this.currentCellsToUpdate.Add(currentCell);
                }
            }

            this.Owner.UpdatePresenters(this.currentCellsToUpdate);
        }