/// <summary> /// Updates the content in all of the panels in flipview. /// </summary> private void UpdatePanelContent() { // Lock the list lock (m_postsLists) { int minContentLoad = ui_flipView.SelectedIndex - CACHE_BACK_COUNT; int maxContentLoad = ui_flipView.SelectedIndex + CACHE_FORWARD_COUNT; for (int i = 0; i < m_postsLists.Count; i++) { Post post = m_postsLists[i]; if (i >= minContentLoad && i <= maxContentLoad) { // We found an item to preload, ask it to. SetPostContent(ref post, ui_flipView.SelectedIndex == i); // If this is the current item also preload the comments if (ui_flipView.SelectedIndex == i) { PreFetchPostComments(ref post); } } else { ClearPostContent(ref post); ClearPostComments(ref post); } } // Check if we should load more posts. Note we want to check how many post the // collector has because this gets called when the m_postList is being built, thus // the count will be wrong. if (m_postsLists.Count > 5 && m_collector.GetCurrentPosts().Count < maxContentLoad + 4) { m_collector.ExtendCollection(25); } } // Update the header sizes SetHeaderSizes(); }
private void Ui_postList_OnListEndDetectedEvent(object sender, HelperControls.OnListEndDetected e) { // Suppress more event until we get more items. ui_postList.SuppressEndOfListEvent = true; m_collector.ExtendCollection(); }