Esempio n. 1
0
        private async void ForwardButton_Click(object sender, RoutedEventArgs e)
        {
            _currentPage++;
            BackButton.IsEnabled = _currentPage >= 2 ? true : false;
            string html =
                await
                _rapSheetManager.GetRapSheet(Constants.BASE_URL + Constants.RAP_SHEET +
                                             string.Format(Constants.PAGE_NUMBER, _currentPage));

            RapSheetWebView.NavigateToString(html);
        }
Esempio n. 2
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)
        {
            ForwardButton.IsEnabled = true;
            BackButton.IsEnabled    = false;
            string html;

            if (e.NavigationParameter != null && !string.IsNullOrEmpty((string)e.NavigationParameter))
            {
                long userId = Convert.ToInt64(e.NavigationParameter);
                ForwardButton.IsEnabled = false;
                html = await
                       _rapSheetManager.GetRapSheet(Constants.BASE_URL +
                                                    string.Format(Constants.USER_RAP_SHEET, userId));

                NoRapSheetTextBlock.Text =
                    string.Format(
                        "This user has not done anything stupid yet.{0}Sorry to disappoint you, so look at this instead.{0}{1}", System.Environment.NewLine,
                        Constants.ASCII_3);
            }
            else
            {
                html = await _rapSheetManager.GetRapSheet(Constants.BASE_URL + Constants.RAP_SHEET);

                NoRapSheetTextBlock.Text =
                    string.Format(
                        "Everyone is perfect and has no flaws.{0}Sorry to disappoint you, so look at this instead.{0}{1}", System.Environment.NewLine,
                        Constants.ASCII_3);
            }
            RapSheetWebView.NavigateToString(html);
            if (!string.IsNullOrEmpty(html))
            {
                return;
            }
            ForwardButton.IsEnabled        = false;
            RapSheetWebView.Visibility     = Visibility.Collapsed;
            NoRapSheetTextBlock.Visibility = Visibility.Visible;
        }