Exemplo n.º 1
0
        /// <summary>
        /// Helper method that determines whether a given RowCacheChange will have 
        /// an impact on currently-visible rows. 
        /// </summary>
        /// <param name="change"></param> 
        /// <returns></returns>
        private bool RowCacheChangeIsVisible(RowCacheChange change)
        {
            int firstVisibleRow = _firstVisibleRow; 
            int lastVisibleRow = _firstVisibleRow + _visibleRowCount;
 
            int firstChangedRow = change.Start; 
            int lastChangedRow = change.Start + change.Count;
 
            //If the first changed row (and hence following changes) are visible OR
            //The last changed row (and hence prior changes) are visible OR
            //if the changes are a super-set of the visible range, then the change is visible.
            if ((firstChangedRow >= firstVisibleRow && firstChangedRow <= lastVisibleRow) || 
                (lastChangedRow >= firstVisibleRow && lastChangedRow <= lastVisibleRow) ||
                (firstChangedRow < firstVisibleRow && lastChangedRow > lastVisibleRow)) 
            { 
                return true;
            } 

            return false;
        }
Exemplo n.º 2
0
        // Token: 0x060071E1 RID: 29153 RVA: 0x00209034 File Offset: 0x00207234
        private void OnPageCacheChanged(object sender, PageCacheChangedEventArgs args)
        {
            if (this._isLayoutCompleted)
            {
                List <RowCacheChange> list = new List <RowCacheChange>(args.Changes.Count);
                for (int i = 0; i < args.Changes.Count; i++)
                {
                    PageCacheChange pageCacheChange = args.Changes[i];
                    switch (pageCacheChange.Type)
                    {
                    case PageCacheChangeType.Add:
                    case PageCacheChangeType.Update:
                        if (pageCacheChange.Start > this.LastPageInCache)
                        {
                            RowCacheChange rowCacheChange = this.AddPageRange(pageCacheChange.Start, pageCacheChange.Count);
                            if (rowCacheChange != null)
                            {
                                list.Add(rowCacheChange);
                            }
                        }
                        else if (pageCacheChange.Start + pageCacheChange.Count - 1 <= this.LastPageInCache)
                        {
                            RowCacheChange rowCacheChange2 = this.UpdatePageRange(pageCacheChange.Start, pageCacheChange.Count);
                            if (rowCacheChange2 != null)
                            {
                                list.Add(rowCacheChange2);
                            }
                        }
                        else
                        {
                            RowCacheChange rowCacheChange3 = this.UpdatePageRange(pageCacheChange.Start, this.LastPageInCache - pageCacheChange.Start);
                            if (rowCacheChange3 != null)
                            {
                                list.Add(rowCacheChange3);
                            }
                            rowCacheChange3 = this.AddPageRange(this.LastPageInCache + 1, pageCacheChange.Count - (this.LastPageInCache - pageCacheChange.Start));
                            if (rowCacheChange3 != null)
                            {
                                list.Add(rowCacheChange3);
                            }
                        }
                        break;

                    case PageCacheChangeType.Remove:
                        if (this.PageCache.PageCount - 1 < this.LastPageInCache)
                        {
                            RowCacheChange rowCacheChange4 = this.TrimPageRange(this.PageCache.PageCount);
                            if (rowCacheChange4 != null)
                            {
                                list.Add(rowCacheChange4);
                            }
                        }
                        if (this._rowCache.Count <= 1 && (this._rowCache.Count == 0 || this._rowCache[0].PageCount < this._layoutColumns))
                        {
                            this.RecalcRows(0, this._layoutColumns);
                        }
                        break;

                    default:
                        throw new ArgumentOutOfRangeException("args");
                    }
                }
                RowCacheChangedEventArgs e = new RowCacheChangedEventArgs(list);
                this.RowCacheChanged(this, e);
                return;
            }
            if (this._isLayoutRequested)
            {
                this.RecalcRows(this._layoutPivotPage, this._layoutColumns);
            }
        }