Esempio n. 1
0
        /// <summary>
        ///     Populates the page with content passed during navigation. Any saved state is also
        ///     provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        ///     The source of the event; typically <see cref="NavigationHelper" />
        /// </param>
        /// <param name="e">
        ///     Event data that provides both the navigation parameter passed to
        ///     <see cref="Frame.Navigate(Type, Object)" /> when this page was initially requested and
        ///     a dictionary of state preserved by this page during an earlier
        ///     session. The state will be null the first time a page is visited.
        /// </param>
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            loadingProgressBar.Visibility = Visibility.Visible;
            _forumThread   = (ForumThreadEntity)e.NavigationParameter;
            pageTitle.Text = _forumThread.Name;

            _threadPosts = await _postManager.GetThreadPosts(_forumThread);

            CurrentPageSelector.ItemsSource   = Enumerable.Range(1, _forumThread.TotalPages).ToArray();
            CurrentPageSelector.SelectedValue = _forumThread.CurrentPage;
            BackButton.IsEnabled      = _forumThread.CurrentPage > 1;
            ForwardButton.IsEnabled   = _forumThread.TotalPages != _forumThread.CurrentPage;
            ReplyButton.IsEnabled     = !_forumThread.IsLocked;
            DefaultViewModel["Posts"] = _threadPosts;
            if (_forumThread.ScrollToPost > 0)
            {
                ThreadListFullScreen.ScrollIntoView(_threadPosts[_forumThread.ScrollToPost]);
            }
            loadingProgressBar.Visibility = Visibility.Collapsed;

            // TODO: Remove duplicate buttons and find a better way to handle navigation
            BackButtonSnap.IsEnabled              = _forumThread.CurrentPage > 1;
            ForwardButtonSnap.IsEnabled           = _forumThread.TotalPages != _forumThread.CurrentPage;
            CurrentPageSelectorSnap.ItemsSource   = Enumerable.Range(1, _forumThread.TotalPages).ToArray();
            CurrentPageSelectorSnap.SelectedValue = _forumThread.CurrentPage;
        }
Esempio n. 2
0
 private void GoToLastPostButton_Click(object sender, RoutedEventArgs e)
 {
     //ThreadListSnapped.ScrollIntoView(_threadPosts.Last());
     ThreadListFullScreen.ScrollIntoView(_threadPosts.Last());
 }