Example #1
0
        /// <summary>
        /// Fired when the flip panel selection changes.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void FlipView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (ui_flipView.SelectedIndex == -1)
            {
                return;
            }

            // Mark the item read.
            _collector.MarkPostRead(((FlipViewPostItem)ui_flipView.SelectedItem)?.Context.Post, ui_flipView.SelectedIndex);

            // Hide the comment box if open
            HideCommentBoxIfOpen();

            // If the index is 0 we are most likely doing a first load, so we want to
            // set the panel content instantly so we get the loading UI as fast a possible.
            if (ui_flipView.SelectedIndex == 0)
            {
                // Update the posts
                UpdatePanelContent();
            }
            else
            {
                // Kick off the panel content update to the UI thread with idle pri to give the UI time to setup.
                await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, UpdatePanelContent);
            }

            // Now if we have deferred post add them
            DoDeferredPostUpdate();
        }