protected void RenderTopic() { if ((_topic == null) || !_topic.IsLoaded || (_topicTitleTextBlock == null) || (_topicBodyPanel == null) || (_topicScrollViewer == null)) { return; } MitbbsLink historyLink = App.Settings.FindHistoryEntry(_originalUrl); if (historyLink != null && _topicScrollViewer != null) { if (_topic != null && _topic.PageIndex >= 1) { historyLink.LastVisitedUrl = _topic.Url; historyLink.LastPage = _topic.LastPageIndex; if (_topic.PageIndex == _topic.LastPageIndex) { historyLink.LastVisitedPageContentCount = _topic.Posts.Count; } if (_topic.PageIndex == 1) { historyLink.Name = _topic.Title; } } } App.Settings.CurrentSessionHistory.SetLastPageName(NavigationService, _topic.Title, "阅读文章"); CookieAwareClient web = new CookieAwareClient(); web.Cookies = App.WebSession.Cookies; _imageLoader.Web = web; _imageLoader.DisplayPanel = _topicBodyPanel; _imageLoader.ScrollPanel = _topicScrollViewer; _imageLoader.Page = this; _imageLoader.FontSize = (double)App.Current.Resources["MitbbsFontSizeText"]; _imageLoader.IsOffline = _offline; _imageLoader.OfflineID = _offlineID; _imageLoader.IsClub = _club; _topicTitleTextBlock.Visibility = Visibility.Collapsed; TextBlock titleText = new TextBlock(); //titleText.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; //titleText.TextAlignment = TextAlignment.Center; titleText.Style = (Style)App.Current.Resources["PhoneTextAccentStyle"]; titleText.FontSize = (double)App.Current.Resources["MitbbsFontSizeText"]; titleText.Margin = new Thickness(2); titleText.TextWrapping = TextWrapping.Wrap; titleText.Text = _topic.Title; _topicBodyPanel.Children.Add(titleText); if (!String.IsNullOrEmpty(_topic.BoardName)) { TextBlock boardText = new TextBlock(); //boardText.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; //boardText.TextAlignment = TextAlignment.Center; boardText.Style = (Style)App.Current.Resources["PhoneTextAccentStyle"]; boardText.FontSize = (double)App.Current.Resources["MitbbsFontSizeNormal"]; boardText.Margin = new Thickness(0, 3, 0, 3); boardText.TextWrapping = TextWrapping.Wrap; boardText.Text = "版面: " + _topic.BoardName; _topicBodyPanel.Children.Add(boardText); } foreach (MitbbsPostBase post in _topic.Posts) { RenderPost(post); } // Ending the page // Border bd2 = new Border(); bd2.Margin = new Thickness(0); bd2.BorderThickness = new Thickness(1); bd2.CornerRadius = new CornerRadius(8); bd2.BorderBrush = (Brush)App.Current.Resources["PhoneAccentBrush"]; bd2.HorizontalAlignment = HorizontalAlignment.Stretch; TextBlock tb2 = new TextBlock(); tb2.HorizontalAlignment = HorizontalAlignment.Center; tb2.Style = (Style)App.Current.Resources["PhoneTextSubtleStyle"]; tb2.FontSize = (double)App.Current.Resources["MitbbsFontSizeNormal"]; if (_topic.NextPageUrl != null) { tb2.Text = "本页末尾"; } else { tb2.Text = "文章末尾"; } bd2.Child = tb2; _topicBodyPanel.Children.Add(bd2); _topicBodyPanel.Visibility = Visibility.Visible; if (_scrollOffset >= 0) { _topicScrollViewer.UpdateLayout(); _topicScrollViewer.ScrollToVerticalOffset(_scrollOffset); _scrollOffset = -1; } else if (_resetScrollPos) { _topicScrollViewer.UpdateLayout(); _topicScrollViewer.ScrollToVerticalOffset(0); } }
private void InputPage_Loaded(object sender, DataLoadedEventArgs e) { LoadProgressBar.Visibility = Visibility.Collapsed; (ApplicationBar.Buttons[1] as ApplicationBarIconButton).IsEnabled = true; //close button if (_postForward.IsInputPageLoaded) { CookieAwareClient web = new CookieAwareClient(); web.Cookies = App.WebSession.Cookies; _imageLoader.Web = web; DisableRect.Visibility = Visibility.Collapsed; if (BoardNameTextBox.Text == "") { BoardNameTextBox.Text = _postForward.BoardName; } _imageLoader.ClearImages(); if (_postForward.VerifyImageUrl != null) { _imageLoader.LoadImage( _postForward.VerifyImageUrl, _postForward.InputPageUrl, null, false, false, "<正在打开验证码图片...>", "<无法开打验证码图片>" ); VerifyCodeTextBox.Text = ""; VerifyPanel.Visibility = Visibility.Visible; } else { VerifyPanel.Visibility = Visibility.Collapsed; } (ApplicationBar.Buttons[0] as ApplicationBarIconButton).IsEnabled = true; //forward button } else { MessageBoxResult result = MessageBox.Show("是否要重试?如果你已多次遇到此错误,请尝试重新登录。", "读取转帖页面失败!", MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { LoadInputPage(); } else { NavigationService.GoBack(); } } }