/// <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)
        {

            var userId = (long) e.NavigationParameter;
            DefaultViewModel["UserHistory"] =
                await this._forumSearchManager.GetSearchResults(string.Format(Constants.USER_POST_HISTORY, userId));
        }
Exemplo 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 void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     var jsonObjectString = (string) e.NavigationParameter;
     _forumThread = JsonConvert.DeserializeObject<ForumThreadEntity>(jsonObjectString);
     if (_forumThread == null) return;
     _vm.GetForumPosts(_forumThread);
 }
 /// <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)
 {
     var stringJson = (String)e.NavigationParameter;
     _privateMessageEntity = JsonConvert.DeserializeObject<PrivateMessageEntity>(stringJson);
     PrivateMessageTextBlock.Text = _privateMessageEntity.Title;
     PrivateMessageWebView.NavigateToString(await _privateMessageManager.GetPrivateMessageHtml(_privateMessageEntity.MessageUrl));
 }
Exemplo n.º 4
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;
        }
Exemplo n.º 5
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;
         var rapSheet = new List<ForumUserRapSheetEntity>();
         if (e.NavigationParameter != null)
         {
             long userId = Convert.ToInt64(e.NavigationParameter);
             ForwardButton.IsEnabled = false;
             rapSheet =
                 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
         {
             
             DefaultViewModel["RapSheet"] =
                 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);
         }
         DefaultViewModel["RapSheet"] = rapSheet;
         if (rapSheet != null && rapSheet.Count > 0) return;
         ForwardButton.IsEnabled = false;
         RapSheetListView.Visibility = Visibility.Collapsed;
         NoRapSheetTextBlock.Visibility = Visibility.Visible;
     }
Exemplo n.º 6
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)
 {
     this.loadingProgressBar.Visibility = Visibility.Visible;
     List<ForumCategoryEntity> forumGroupList = await this._forumManager.GetForumCategoryMainPage();
     this.DefaultViewModel["Groups"] = forumGroupList;
     this.DefaultViewModel["ForumCategory"] = forumGroupList;
     this.loadingProgressBar.Visibility = Visibility.Collapsed;
 }
Exemplo n.º 7
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 void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     var jsonObjectString = (string)e.NavigationParameter;
     _forumEntity = JsonConvert.DeserializeObject<ForumEntity>(jsonObjectString);
     if (_forumEntity == null) return;
     if (_vm.ForumEntity == null || _vm.ForumEntity.ForumId != _forumEntity.ForumId)
     _vm.Initialize(_forumEntity);
 }
Exemplo n.º 8
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 void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            _forumPost = e.NavigationParameter as ForumPostEntity;
            if(_forumPost != null)
            ReplyText.Text = string.Format(Constants.QUOTE_EXP, _forumPost.User.Username, _forumPost.PostId, _forumPost.PostFormatted);

            _forumThread = e.NavigationParameter as ForumThreadEntity;
        }
Exemplo n.º 9
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)
 {
     var jsonObjectString = (string)e.NavigationParameter;
     var result =  await _vm.Initialize(jsonObjectString);
     if (!result)
     {
         var msgDlg = new MessageDialog("You can't make a new thread in this forum!");
         await msgDlg.ShowAsync();
         Frame.GoBack();
     }
 }
Exemplo n.º 10
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)
 {
     long userId;
     userId = Convert.ToInt64(e.NavigationParameter);
     ForumUserEntity userProfile = await _forumUserManager.GetUserFromProfilePage(userId);
     DefaultViewModel["UserEntity"] = userProfile;
     DefaultViewModel["RapSheet"] =
         await _rapSheetManager.GetRapSheet(Constants.BASE_URL + string.Format(Constants.USER_RAP_SHEET, userId));
     DefaultViewModel["UserSearch"] =
         await _forumSearchManager.GetSearchResults(string.Format(Constants.USER_POST_HISTORY, userId));
 }
Exemplo n.º 11
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;
            // TODO: Assign a bindable collection of items to this.DefaultViewModel["Items"]

            _forumEntity = (ForumEntity) e.NavigationParameter;
            pageTitle.Text = _forumEntity.Name;
            pageSnapTitle.Text = _forumEntity.Name;
            await GetForumThreads();
            loadingProgressBar.Visibility = Visibility.Collapsed;
        }
Exemplo n.º 12
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 void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     var jsonObjectString = (string)e.NavigationParameter;
     var blankPostIconEntity = new PostIconEntity { Id = 0, Title = "Shit" };
     PostIconImage.Source = new BitmapImage(new Uri("ms-appx://Assets/shitpost.gif"));
     _postIcon = blankPostIconEntity;
     if (string.IsNullOrEmpty(jsonObjectString)) return;
     var privateMessage = JsonConvert.DeserializeObject<PrivateMessageEntity>(jsonObjectString);
     if (privateMessage == null) return;
     SubjectTextBox.Text = string.Format("Re: {0}", privateMessage.Title);
     RecipientTextBox.Text = privateMessage.Sender;
 }
Exemplo n.º 13
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)
        {
            // TODO: Assign a bindable collection of items to this.DefaultViewModel["Items"]
            loadingProgressBar.Visibility = Visibility.Visible;

            var jsonObjectString = (string) e.NavigationParameter;
            var forumInfo = JsonConvert.DeserializeObject<ForumEntity>(jsonObjectString);
            if (forumInfo == null) return;
            _forumEntity = forumInfo;
            pageTitle.Text = _forumEntity.Name;
            await GetForumThreads();
            loadingProgressBar.Visibility = Visibility.Collapsed;
        }
Exemplo n.º 14
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 void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     _localSettings = ApplicationData.Current.LocalSettings;
     if (_localSettings.Values.ContainsKey(Constants.BOOKMARK_STARTUP))
     {
         var bookmarks = (bool) _localSettings.Values[Constants.BOOKMARK_STARTUP];
         if (bookmarks)
         {
             ForumsPivot.SelectedIndex = 1;
         }
     }
     var forum = new ForumEntity("Bookmarks", Constants.USER_CP, string.Empty, false);
     _threadVm.Initialize(forum);
 }
Exemplo n.º 15
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)
        {
            HtmlDocument doc = await _frontPageManager.GetFrontPage();
            DefaultViewModel["PopularThreads"] = _frontPageManager.GetPopularThreads(doc);
            DefaultViewModel["PopularTrends"] = _frontPageManager.GetPopularTrends(doc);
            List<FrontPageArticleEntity> frontPageArticles = _frontPageManager.GetFrontPageArticles(doc);

            FrontPageArticleEntity mainArticle = frontPageArticles.FirstOrDefault();
            DefaultViewModel["MainArticle"] = mainArticle;
            frontPageArticles.Remove(mainArticle);

            DefaultViewModel["FrontPageArticles"] = frontPageArticles;
            DefaultViewModel["FrontPageFeatures"] = _frontPageManager.GetFeatures(doc);
        }
Exemplo n.º 16
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)
 {
     // TODO: Actually do forward/backward paging on user post history.
     ForwardButton.IsEnabled = false;
     BackButton.IsEnabled = false;
     long userId = Convert.ToInt64(e.NavigationParameter);
     string html = await _forumSearchManager.GetSearchResults(string.Format(Constants.USER_POST_HISTORY, userId));
     PostHistoryWebView.NavigateToString(html);
     if (!string.IsNullOrEmpty(html)) return;
     DenyPostHistoryTextBlock.Text =  string.Format(
         "What? Nothing here?!?{0}You probably have to buy platinum access to see this.{0} Get that first, I'll be waiting...{0}{1}", Environment.NewLine,
         Constants.ASCII_5);
     PostHistoryWebView.Visibility = Visibility.Collapsed;
     DenyPostHistoryTextBlock.Visibility = Visibility.Visible;
 }
Exemplo n.º 17
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)
        {
            // TODO: Assign a bindable collection of items to this.DefaultViewModel["Items"]
            //loadingProgressBar.Visibility = Visibility.Visible;

            var jsonObjectString = (string) e.NavigationParameter;
            _forumEntity = JsonConvert.DeserializeObject<ForumEntity>(jsonObjectString);
            if (_forumEntity == null) return;
            if (_vm.ForumEntity == null || _vm.ForumEntity.ForumId != _forumEntity.ForumId || _forumEntity.IsBookmarks)
                _vm.Initialize(_forumEntity);

            // TODO: This is stupid shit that should be removed.
            ViewStateStringFullScreen = "FullScreen" + GetViewStateString(_forumEntity.ForumId);
            ViewStateStringSnapped = "Snapped" + GetViewStateString(_forumEntity.ForumId);
        }
Exemplo n.º 18
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)
        {
            // TODO: This view should NOT need to do any html parsing. Get this out of here!
            HtmlDocument doc = await _frontPageManager.GetFrontPage();
            DefaultViewModel["PopularThreads"] = _frontPageManager.GetPopularThreads(doc);
            DefaultViewModel["PopularTrends"] = _frontPageManager.GetPopularTrends(doc);
            List<FrontPageArticleEntity> frontPageArticles = _frontPageManager.GetFrontPageArticles(doc);

            FrontPageArticleEntity mainArticle = frontPageArticles.FirstOrDefault();
            DefaultViewModel["MainArticle"] = mainArticle;
            _mainArticle = mainArticle;
            frontPageArticles.Remove(mainArticle);

            DefaultViewModel["FrontPageArticles"] = frontPageArticles;
            DefaultViewModel["FrontPageFeatures"] = _frontPageManager.GetFeatures(doc);
        }
Exemplo n.º 19
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)
 {
     // TODO: Actually do forward/backward paging on user post history.
     ForwardButton.IsEnabled = false;
     BackButton.IsEnabled = false;
     long userId = Convert.ToInt64(e.NavigationParameter);
     List<ForumSearchEntity> postHistory =
         await _forumSearchManager.GetSearchResults(string.Format(Constants.USER_POST_HISTORY, userId));
     DefaultViewModel["UserHistory"] =
         postHistory;
     if (postHistory != null && postHistory.Count >= 1) return;
     DenyPostHistoryTextBlock.Text =  string.Format(
         "What? Nothing here?!?{0}You probably have to buy platinum access to see this.{0} Get that first, I'll be waiting...{0}{1}", System.Environment.NewLine,
         Constants.ASCII_5);
     PostHistorytListView.Visibility = Visibility.Collapsed;
     DenyPostHistoryTextBlock.Visibility = Visibility.Visible;
 }
Exemplo n.º 20
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;
     if (e.NavigationParameter != null)
     {
         var userId = (long) e.NavigationParameter;
         DefaultViewModel["RapSheet"] =
             await
                 this._rapSheetManager.GetRapSheet(Constants.BASE_URL + string.Format(Constants.USER_RAP_SHEET, userId));
     }
     else
     {
         DefaultViewModel["RapSheet"] =
             await this._rapSheetManager.GetRapSheet(Constants.BASE_URL + Constants.RAP_SHEET);
     }
 }
Exemplo n.º 21
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)
 {
     long userId;
     userId = Convert.ToInt64(e.NavigationParameter);
     ForumUserEntity userProfile = null;
     try
     {
         userProfile = await _forumUserManager.GetUserFromProfilePage(userId);
     }
     catch (Exception)
     {
         // User does not exist.
         // Can't show error message block in try/catch.
     }
     if (userProfile == null)
     {
         var msgDlg = new MessageDialog("User does not exist.");
         await msgDlg.ShowAsync();
         Frame.GoBack();
         return;
     }
     pageTitle.Text = string.Format("Profile - {0}", userProfile.Username);
     DefaultViewModel["UserEntity"] = userProfile;
     string rapsheetHtml = await _rapSheetManager.GetRapSheet(Constants.BASE_URL + string.Format(Constants.USER_RAP_SHEET, userId));
     string postHistoryHtml = await _forumSearchManager.GetSearchResults(string.Format(Constants.USER_POST_HISTORY, userId));
     if (string.IsNullOrEmpty(rapsheetHtml))
     {
         RapSheetTextBlock.Text =
             string.Format(
                 "Sorry, but you can't make yourself feel better by judging this user. They've done nothing wrong!{0}Don't you feel like shit now? Knowing that you are not as good as this, pure, goon?{0}I wish I could help you, but I'm just an awful forum viewer.{0}I can't fix your f****d up life and post history.",
                 Environment.NewLine);
         RapSheetWebView.Visibility = Visibility.Collapsed;
         RapSheetTextBlock.Visibility = Visibility.Visible;
     }
     if (string.IsNullOrEmpty(postHistoryHtml))
     {
         DenyPostHistoryTextBlock.Text = string.Format("What? No post history?!? What has brought such tragedy?!{0}Oh yeah, you need platinum access to see this. Get that first.", Environment.NewLine);
         PostHistoryWebView.Visibility = Visibility.Collapsed;
         DenyPostHistoryTextBlock.Visibility = Visibility.Visible;
     }
     DefaultViewModel["RapSheetHtml"] = rapsheetHtml;
     DefaultViewModel["UserSearchHtml"] = postHistoryHtml;
 }
Exemplo n.º 22
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)
 {
     var jsonObjectString = (string)e.NavigationParameter;
     var forumInfo = JsonConvert.DeserializeObject<ForumEntity>(jsonObjectString);
     if (forumInfo == null) return;
     pageTitle.Text = string.Format("New Thread - {0}", forumInfo.Name);
     _forumEntity = forumInfo;
     _newThreadEntity = await _threadManager.GetThreadCookies(forumInfo.ForumId);
     if (_newThreadEntity == null)
     {
         var msgDlg = new MessageDialog("You can't make a new thread in this forum!");
         await msgDlg.ShowAsync();
         Frame.GoBack();
         return;
     }
     var blankPostIconEntity = new PostIconEntity {Id = 0, Title = "Shit"};
     PostIconImage.Source = new BitmapImage(new Uri("ms-appx://Assets/shitpost.gif"));
     _postIcon = blankPostIconEntity;
 }
Exemplo n.º 23
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)
 {
     // TODO: Assign a collection of bindable groups to this.DefaultViewModel["Groups"]
     var user = (ForumUserEntity) e.NavigationParameter;
     long userId;
     if (user == null)
     {
         userId = (long) e.NavigationParameter;
     }
     else
     {
         userId = user.Id;
     }
     var userProfile = await this._forumUserManager.GetUserFromProfilePage(user, userId);
     DefaultViewModel["UserEntity"] = userProfile;
     DefaultViewModel["RapSheet"] =
         await this._rapSheetManager.GetRapSheet(Constants.BASE_URL + string.Format(Constants.USER_RAP_SHEET, userId));
     DefaultViewModel["UserSearch"] =
         await this._forumSearchManager.GetSearchResults(string.Format(Constants.USER_POST_HISTORY, userId));
 }
Exemplo n.º 24
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 void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            _localSettings = ApplicationData.Current.LocalSettings;
            if (_localSettings.Values.ContainsKey(Constants.BOOKMARK_STARTUP))
            {
                var bookmarks = (bool) _localSettings.Values[Constants.BOOKMARK_STARTUP];
                if (bookmarks)
                {
                    ForumsPivot.SelectedIndex = 1;
                }
            }
            var forum = new ForumEntity()
            {
                Name = "Bookmarks",
                IsSubforum = false,
                Location = Constants.USER_CP,
                IsBookmarks = true
            };
            if (_vm.ThreadListPageViewModel != null) return;
            _vm.ThreadListPageViewModel = new ThreadListPageViewModel();
            _vm.ThreadListPageViewModel.Initialize(forum);
            BookmarksPivotItem.DataContext = _vm.ThreadListPageViewModel;

        }
Exemplo n.º 25
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 void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
 }
Exemplo n.º 26
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;
     var jsonObjectString = (string) e.NavigationParameter;
     long threadId = Convert.ToInt64(jsonObjectString);
     _forumReply = await _replyManager.GetReplyCookiesForEdit(threadId);
     if (_forumReply == null)
     {
         var msgDlg = new MessageDialog("You can't edit this post!");
         await msgDlg.ShowAsync();
         Frame.GoBack();
         return;
     }
     ReplyText.Text = _forumReply.Quote;
     PreviewLastPostWebView.NavigateToString(_forumReply.PreviousPostsRaw);
     LoadingProgressBar.Visibility = Visibility.Collapsed;
 }
Exemplo n.º 27
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)
 {
     var jsonObjectString = (string) e.NavigationParameter;
     bool result = await _vm.Initialize(jsonObjectString);
     _vm.GetSmilies();
     if (result)
     {
         ReplyText.Text = _vm.ForumReplyEntity.Quote;
         return;
     }
     var msgDlg = new MessageDialog("You can't reply in this thread!");
     await msgDlg.ShowAsync();
     Frame.GoBack();
 }
Exemplo n.º 28
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;
            var jsonObjectString = (string) e.NavigationParameter;
            long threadId = 0;
            try
            {
                _forumThread = JsonConvert.DeserializeObject<ForumThreadEntity>(jsonObjectString);
            }
            catch (Exception)
            {
                threadId = Convert.ToInt64(jsonObjectString);
            }

            //_forumPost = e.NavigationParameter as ForumPostEntity;
            if (_forumThread != null)
            {
                _forumReply = await _replyManager.GetReplyCookies(_forumThread);
            }
            else
            {
                _forumReply = await _replyManager.GetReplyCookies(threadId);
            }
            if (_forumReply == null)
            {
                var msgDlg = new MessageDialog("Can't reply in this thread!");
                await msgDlg.ShowAsync();
                Frame.GoBack();
                return;
            }
            ReplyText.Text = _forumReply.Quote;
            PreviousPostsWebView.NavigateToString(_forumReply.PreviousPostsRaw);
            loadingProgressBar.Visibility = Visibility.Collapsed;
        }
Exemplo n.º 29
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)
 {
     var url = (string) e.NavigationParameter;
     var articleEntity = await _frontPageManager.GetArticleMetaData(url);
     ArticleWebView.NavigateToString(articleEntity.ArticleHtml);
 }
Exemplo n.º 30
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 void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     _vm.GetPrivateMessages();
 }