예제 #1
0
        internal object GetItemAt(int index)
        {
            if ((index < 0) || (index >= m_virtualCount))
            {
                throw new ArgumentOutOfRangeException("Index", index, "index must be greater than or equal to zero and less than count.");
            }

            VirtualizedItemInfo virtualizedItemInfo = this.GetVirtualizedItemInfoAtIndex(index, true, false);

            return(virtualizedItemInfo.DataItem);
        }
예제 #2
0
        internal void ClearCachedValuesForItemAtIndex(int index)
        {
            VirtualizedItemInfo virtualizedItemInfo = this.GetVirtualizedItemInfoAtIndex(index, false, true);

            if (virtualizedItemInfo == null)
            {
                throw new ArgumentOutOfRangeException("index", index, "No VirtualizedItemInfo can be found at the specified index.");
            }

            virtualizedItemInfo.OldValues = null;
        }
예제 #3
0
        internal void SetCachedValuesForItemAtIndex(int index, string[] names, object[] values)
        {
            VirtualizedItemInfo virtualizedItemInfo = this.GetVirtualizedItemInfoAtIndex(index, false, true);

            if (virtualizedItemInfo == null)
            {
                throw new ArgumentOutOfRangeException("index", index, "No VirtualizedItemInfo can be found at the specified index.");
            }

            virtualizedItemInfo.OldValues = new VirtualizedItemValueCollection(names, values);
        }
예제 #4
0
        internal bool IsItemDirty(object item)
        {
            int localIndex = this.IndexOf(item);

            if (localIndex == -1)
            {
                return(false);
            }

            VirtualizedItemInfo virtualizedItemInfo = this.GetVirtualizedItemInfoAtIndex(localIndex, false, true);

            return((virtualizedItemInfo == null) ? false : virtualizedItemInfo.IsDirty);
        }
        public void AddPage(VirtualPage page)
        {
            Debug.Assert(!m_virtualPages.Contains(page));

            m_virtualPages.Add(page);

            int itemCount = page.Count;

            for (int i = 0; i < itemCount; i++)
            {
                VirtualizedItemInfo virtualizedItemInfo = page[i];

                Debug.Assert(!m_objectVersusIndexDictionary.ContainsKey(virtualizedItemInfo.DataItem));
                Debug.Assert(!m_indexVersusPageDictionary.ContainsKey(virtualizedItemInfo.Index));

                m_objectVersusIndexDictionary.Add(virtualizedItemInfo.DataItem, virtualizedItemInfo.Index);
                m_indexVersusPageDictionary.Add(virtualizedItemInfo.Index, page);
            }
        }
        public void RemovePage(VirtualPage page)
        {
            Debug.Assert(m_virtualPages.Contains(page));

            int itemCount = page.Count;

            for (int i = 0; i < itemCount; i++)
            {
                VirtualizedItemInfo virtualizedItemInfo = page[i];

                Debug.Assert(m_objectVersusIndexDictionary.ContainsKey(virtualizedItemInfo.DataItem));
                Debug.Assert(m_indexVersusPageDictionary.ContainsKey(virtualizedItemInfo.Index));

                Debug.Assert(m_indexVersusPageDictionary[virtualizedItemInfo.Index] == page);

                m_objectVersusIndexDictionary.Remove(virtualizedItemInfo.DataItem);
                m_indexVersusPageDictionary.Remove(virtualizedItemInfo.Index);
            }

            m_virtualPages.Remove(page);
        }
예제 #7
0
        internal VirtualizedItemInfo GetVirtualizedItemInfoAtIndex(int index, bool createPageIfLineNotFound, bool preventMovePageToFront)
        {
            VirtualizedItemInfo virtualizedItemInfo = null;

            VirtualPage page = this.GetPageOrDefaultForItemIndex(index, preventMovePageToFront);

            if (page != null)
            {
                virtualizedItemInfo = page.GetVirtualizedItemInfoAtIndex(index);

                Debug.Assert(virtualizedItemInfo != null);


                //if( ( virtualizedItemInfo == null ) && ( createPageIfLineNotFound ) )
                //{
                //  // No VirtualizedItemInfo was found at the requested index.
                //  LinkedListNode<VirtualPage> firstPageNode = m_pageNodes.First;

                //  Debug.Assert( firstPageNode != null, "If the page is not null, there should be at least one page in the book." );

                //  if( firstPageNode.Value != page )
                //  {
                //
                //    page = this.CreateNewPage( index );

                //    virtualizedItemInfo = page.GetVirtualizedItemInfoAtIndex( index );
                //    this.AddPageToFront( page );
                //  }
                //}
            }
            else if (createPageIfLineNotFound)
            {
                page = this.CreateNewPage(index);

                virtualizedItemInfo = page.GetVirtualizedItemInfoAtIndex(index);
                m_pagingManager.AddPage(page, VirtualPageManager.PageInsertPosition.Front);
            }

            return(virtualizedItemInfo);
        }
예제 #8
0
        internal VirtualizedItemValueCollection GetCachedValuesForItemAtIndex(int index)
        {
            VirtualizedItemInfo virtualizedItemInfo = this.GetVirtualizedItemInfoAtIndex(index, false, true);

            return((virtualizedItemInfo == null) ? null : virtualizedItemInfo.OldValues);
        }