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); }
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); }
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; }
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); }
internal AsyncCommitInfo( Dispatcher dispatcher, Action<AsyncCommitInfo> beginCommitDelegate, Action<AsyncCommitInfo> endCommitDelegate, Action<AsyncCommitInfo> commitErrorChangedDelegate, VirtualizedItemInfo[] virtualizedItemInfos ) { m_dispatcher = dispatcher; m_beginCommitDelegate = beginCommitDelegate; m_endCommitDelegate = endCommitDelegate; m_commitErrorChangedDelegate = commitErrorChangedDelegate; m_virtualizedItemInfos = virtualizedItemInfos; }
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); }
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); }
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); } else if (createPageIfLineNotFound) { page = this.CreateNewPage(index); virtualizedItemInfo = page.GetVirtualizedItemInfoAtIndex(index); m_pagingManager.AddPage(page, VirtualPageManager.PageInsertPosition.Front); } return(virtualizedItemInfo); }
internal VirtualizedItemValueCollection GetCachedValuesForItemAtIndex(int index) { VirtualizedItemInfo virtualizedItemInfo = this.GetVirtualizedItemInfoAtIndex(index, false, true); return((virtualizedItemInfo == null) ? null : virtualizedItemInfo.OldValues); }