Пример #1
0
        protected void ShowButtonPanel(MitbbsPostBase post)
        {
            if (__rootGrid == null)
            {
                return;
            }

            if (HideButtonPanel())
            {
                return;
            }

            StackPanel buttonPanel = new StackPanel()
            {
                Orientation = System.Windows.Controls.Orientation.Vertical,
                VerticalAlignment = System.Windows.VerticalAlignment.Center
            };

            String replyToText;
            if (post != null && post.AuthorId != null)
            {
                replyToText = "回信给" + post.AuthorId;
            }
            else
            {
                replyToText = "回信给作者";
            }

            if (!_offline && post.ReplyPostUrl != null)
            {
                buttonPanel.Children.Add(CreatePostButton("reply_roundbutton.png", "回复", post, ReplyButton_Click));
            }

            if (!_offline && _showQuickReply && (post.ReplyPostUrl != null))
            {
                buttonPanel.Children.Add(CreatePostButton("quicksend_roundbutton.png", "快速回复", post, QuickReplyButton_Click));
            }

            if (!_offline && post.ForwardUrl != null)
            {
                buttonPanel.Children.Add(CreatePostButton("lines_roundbutton.png", "转贴其它版面", post, ForwardButton_Click));
            }

            if (!_offline && _showReplyToUser && (post.AuthorId != null) && !(App.WebSession.IsLoggedIn && App.WebSession.Username.ToLower() == post.AuthorId.ToLower()))
            {
                buttonPanel.Children.Add(CreatePostButton("contact_roundbutton.png", replyToText, post, ReplyUserButton_Click));
            }

            if (!_offline && App.WebSession.IsLoggedIn && App.WebSession.Username.ToLower() == post.AuthorId.ToLower())
            {
                if (post.DeletePostUrl != null)
                {
                    buttonPanel.Children.Add(CreatePostButton("trash_roundbutton.png", "删除", post, DeleteButton_Click));
                }
            }

            if (!_offline && App.WebSession.IsLoggedIn && App.WebSession.Username.ToLower() == post.AuthorId.ToLower())
            {
                if (post.ModifyPostUrl != null)
                {
                    buttonPanel.Children.Add(CreatePostButton("edit_roundbutton.png", "编辑", post, ModifyButton_Click));
                }
            }

            buttonPanel.Children.Add(CreatePostButton("copy_roundbutton.png", "复制到剪切板", post, CopyButton_Click));
            buttonPanel.Children.Add(CreatePostButton("people_roundbutton.png", "社交网络分享", post, ShareButton_Click));
            buttonPanel.Children.Add(CreatePostButton("share_roundbutton.png", "邮件分享", post, MailButton_Click));

            Border buttonBorder = new Border()
            {
                BorderBrush = (Brush)App.Current.Resources["PhoneAccentBrush"],
                BorderThickness = new Thickness(2),
                CornerRadius = new CornerRadius(3),
                Background = (Brush)App.Current.Resources["PhoneBackgroundBrush"],
                Child = buttonPanel
            };

            StackPanel rootPanel = new StackPanel()
            {
                Orientation = System.Windows.Controls.Orientation.Vertical,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
                VerticalAlignment = System.Windows.VerticalAlignment.Center
            };

            rootPanel.Children.Add(buttonBorder);

            if (_disableRect != null)
            {
                _disableRect.Visibility = System.Windows.Visibility.Visible;
            }

            _buttonPanel = rootPanel;
            __rootGrid.Children.Add(_buttonPanel);
        }
Пример #2
0
        protected void RenderPost(MitbbsPostBase post)
        {
            // Header
            //
            Border headerLine = new Border();
            headerLine.BorderThickness = new Thickness(1);
            headerLine.Margin = new Thickness(0, 10, 0, 0);
            //headerLine.BorderBrush = (Brush)App.Current.Resources["PhoneAccentBrush"];
            headerLine.BorderBrush = new LinearGradientBrush()
            {
                StartPoint = new Point(0, 0),
                EndPoint = new Point(1, 0),
                GradientStops = new GradientStopCollection()
                    {
                        new GradientStop()
                        {
                            Color = ((SolidColorBrush)App.Current.Resources["PhoneAccentBrush"]).Color,
                            Offset = 0
                        },

                        new GradientStop()
                        {
                            Color = ((SolidColorBrush)App.Current.Resources["PhoneSubtleBrush"]).Color,
                            Offset = 0.8
                        },
                        new GradientStop()
                        {
                            Color = ((SolidColorBrush)App.Current.Resources["PhoneBackgroundBrush"]).Color,
                            Offset = 1
                        },
                    }
            };

            //headerLine.BorderBrush = (Brush)App.Current.Resources["PhoneSubtleBrush"];
            //headerLine.BorderBrush = new SolidColorBrush(Color.FromArgb(255, 112, 146, 190));
            headerLine.Height = .5;

            _firstPostControls.Add(headerLine);
            _topicBodyPanel.Children.Add(headerLine);

            StackPanel headerPanel = new StackPanel();
            headerPanel.Orientation = System.Windows.Controls.Orientation.Vertical;

            Grid headerPanel2 = new Grid();
            ColumnDefinition column1 = new ColumnDefinition();
            column1.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition column2 = new ColumnDefinition();
            column2.Width = new GridLength(1, GridUnitType.Auto);
            headerPanel2.ColumnDefinitions.Add(column1);
            headerPanel2.ColumnDefinitions.Add(column2);

            Grid expandButtonPanel = new Grid();
            expandButtonPanel.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            StackPanel headerPanel3 = new StackPanel();
            headerPanel3.Orientation = System.Windows.Controls.Orientation.Vertical;
            headerPanel3.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            Button expandButton = new Button();
            ImageBrush expandButtonImage = new ImageBrush();
            expandButtonImage.ImageSource = new BitmapImage(new Uri("/MitbbsReader;component/Images/overflowdots.png", UriKind.Relative));
            expandButtonImage.Stretch = Stretch.None;
            expandButton.Style = (Style)Application.Current.Resources["ImageButton"];
            expandButton.Content = expandButtonImage;
            expandButton.Padding = new Thickness(0);
            expandButton.BorderThickness = new Thickness(0);
            expandButton.Margin = new Thickness(0);
            expandButton.Width = 93;
            expandButton.Height = 54;

            GestureListener gl = GestureService.GetGestureListener(expandButton);
            gl.Tap += new EventHandler<Microsoft.Phone.Controls.GestureEventArgs>(GeneralButton_Tapped);

            expandButton.Click += ExpandButton_Click;

            headerPanel3.SetValue(Grid.ColumnProperty, 0);
            expandButtonPanel.SetValue(Grid.ColumnProperty, 1);
            headerPanel2.Children.Add(headerPanel3);
            headerPanel2.Children.Add(expandButtonPanel);
            expandButtonPanel.Children.Add(expandButton);

            headerPanel.Children.Add(headerPanel2);

            TextBlock authorText = new TextBlock();
            authorText.Text = "作者: " + post.Author;
            authorText.FontWeight = FontWeights.ExtraBold;
            //authorText.Style = (Style)App.Current.Resources["PhoneTextAccentStyle"];
            authorText.FontSize = (double)App.Current.Resources["MitbbsFontSizeNormal"];
            authorText.Margin = new Thickness(0);
            authorText.TextWrapping = TextWrapping.Wrap;

            TextBlock sourceText = new TextBlock();
            sourceText.Text = "时间: " + post.IssueDate;
            sourceText.FontWeight = FontWeights.ExtraBold;
            //sourceText.Style = (Style)App.Current.Resources["PhoneTextAccentStyle"];
            sourceText.FontSize = (double)App.Current.Resources["MitbbsFontSizeNormal"];
            sourceText.Margin = new Thickness(0);
            sourceText.TextWrapping = TextWrapping.Wrap;

            headerPanel3.Children.Add(authorText);
            headerPanel3.Children.Add(sourceText);

            //Header buttons
            StackPanel buttonPanel = new StackPanel();
            buttonPanel.Orientation = System.Windows.Controls.Orientation.Horizontal;
            buttonPanel.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;

            Border buttonBorder = new Border();
            buttonBorder.BorderBrush = (Brush)App.Current.Resources["PhoneAccentBrush"];
            buttonBorder.BorderThickness = new Thickness(2);
            buttonBorder.CornerRadius = new CornerRadius(3);
            buttonBorder.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
            buttonBorder.Visibility = Visibility.Collapsed;
            buttonBorder.Child = buttonPanel;

            //expandButton.DataContext = buttonBorder;
            expandButton.DataContext = post;

            int buttonSize = 72;

            //int buttonCount = 0;

            //if (!_offline && post.ReplyPostUrl != null)
            //{
            //    Button replyButton = new Button();
            //    ImageBrush replyButtonImage = new ImageBrush();
            //    replyButtonImage.ImageSource = new BitmapImage(new Uri("/MitbbsReader;component/Images/reply_roundbutton.png", UriKind.Relative));
            //    replyButtonImage.Stretch = Stretch.None;
            //    replyButton.Style = (Style)Application.Current.Resources["ImageButton"];
            //    replyButton.Content = replyButtonImage;
            //    replyButton.Padding = new Thickness(0);
            //    replyButton.BorderThickness = new Thickness(0);
            //    replyButton.Margin = new Thickness(0);
            //    replyButton.Width = buttonSize;
            //    replyButton.Height = buttonSize;

            //    GestureListener gl2 = GestureService.GetGestureListener(replyButton);
            //    gl2.Tap += new EventHandler<Microsoft.Phone.Controls.GestureEventArgs>(GeneralButton_Tapped);

            //    replyButton.Click += ReplyButton_Click;
            //    replyButton.DataContext = post;
            //    buttonPanel.Children.Add(replyButton);
            //    buttonCount++;
            //}

            //if (!_offline && _showQuickReply && (post.ReplyPostUrl != null))
            //{
            //    Button quickReplyButton = new Button();
            //    ImageBrush quickReplyButtonImage = new ImageBrush();
            //    quickReplyButtonImage.ImageSource = new BitmapImage(new Uri("/MitbbsReader;component/Images/quicksend_roundbutton.png", UriKind.Relative));
            //    quickReplyButtonImage.Stretch = Stretch.None;
            //    quickReplyButton.Style = (Style)Application.Current.Resources["ImageButton"];
            //    quickReplyButton.Content = quickReplyButtonImage;
            //    quickReplyButton.Padding = new Thickness(0);
            //    quickReplyButton.BorderThickness = new Thickness(0);
            //    quickReplyButton.Margin = new Thickness(0);
            //    quickReplyButton.Width = buttonSize;
            //    quickReplyButton.Height = buttonSize;

            //    GestureListener gl2 = GestureService.GetGestureListener(quickReplyButton);
            //    gl2.Tap += new EventHandler<Microsoft.Phone.Controls.GestureEventArgs>(GeneralButton_Tapped);

            //    quickReplyButton.Click += QuickReplyButton_Click;
            //    quickReplyButton.DataContext = post;
            //    buttonPanel.Children.Add(quickReplyButton);
            //    buttonCount++;
            //}

            //if (!_offline && post.ForwardUrl != null)
            //{
            //    Button forwardButton = new Button();
            //    ImageBrush forwardButtonImage = new ImageBrush();
            //    forwardButtonImage.ImageSource = new BitmapImage(new Uri("/MitbbsReader;component/Images/Clipboard-file_roundbutton.png", UriKind.Relative));
            //    forwardButtonImage.Stretch = Stretch.None;
            //    forwardButton.Style = (Style)Application.Current.Resources["ImageButton"];
            //    forwardButton.Content = forwardButtonImage;
            //    forwardButton.Padding = new Thickness(0);
            //    forwardButton.BorderThickness = new Thickness(0);
            //    forwardButton.Margin = new Thickness(0);
            //    forwardButton.Width = buttonSize;
            //    forwardButton.Height = buttonSize;

            //    GestureListener gl2 = GestureService.GetGestureListener(forwardButton);
            //    gl2.Tap += new EventHandler<Microsoft.Phone.Controls.GestureEventArgs>(GeneralButton_Tapped);

            //    forwardButton.Click += ForwardButton_Click;
            //    forwardButton.DataContext = post;
            //    buttonPanel.Children.Add(forwardButton);
            //    buttonCount++;
            //}

            //if (!_offline && _showReplyToUser && (post.AuthorId != null) && !(App.WebSession.IsLoggedIn && App.WebSession.Username.ToLower() == post.AuthorId.ToLower()))
            //{
            //    Button replyUserButton = new Button();
            //    ImageBrush replyUserButtonImage = new ImageBrush();
            //    replyUserButtonImage.ImageSource = new BitmapImage(new Uri("/MitbbsReader;component/Images/contact_roundbutton.png", UriKind.Relative));
            //    replyUserButtonImage.Stretch = Stretch.None;
            //    replyUserButton.Style = (Style)Application.Current.Resources["ImageButton"];
            //    replyUserButton.Content = replyUserButtonImage;
            //    replyUserButton.Padding = new Thickness(0);
            //    replyUserButton.BorderThickness = new Thickness(0);
            //    replyUserButton.Margin = new Thickness(0);
            //    replyUserButton.Width = buttonSize;
            //    replyUserButton.Height = buttonSize;

            //    GestureListener gl2 = GestureService.GetGestureListener(replyUserButton);
            //    gl2.Tap += new EventHandler<Microsoft.Phone.Controls.GestureEventArgs>(GeneralButton_Tapped);

            //    replyUserButton.Click += ReplyUserButton_Click;
            //    replyUserButton.DataContext = post;
            //    buttonPanel.Children.Add(replyUserButton);
            //    buttonCount++;
            //}

            //if (!_offline && App.WebSession.IsLoggedIn && App.WebSession.Username.ToLower() == post.AuthorId.ToLower())
            //{
            //    if (post.DeletePostUrl != null)
            //    {
            //        Button deleteButton = new Button();
            //        ImageBrush deleteButtonImage = new ImageBrush();
            //        deleteButtonImage.ImageSource = new BitmapImage(new Uri("/MitbbsReader;component/Images/trash_roundbutton.png", UriKind.Relative));
            //        deleteButtonImage.Stretch = Stretch.None;
            //        deleteButton.Style = (Style)Application.Current.Resources["ImageButton"];
            //        deleteButton.Content = deleteButtonImage;
            //        deleteButton.Padding = new Thickness(0);
            //        deleteButton.BorderThickness = new Thickness(0);
            //        deleteButton.Margin = new Thickness(0);
            //        deleteButton.Width = buttonSize;
            //        deleteButton.Height = buttonSize;

            //        GestureListener gl2 = GestureService.GetGestureListener(deleteButton);
            //        gl2.Tap += new EventHandler<Microsoft.Phone.Controls.GestureEventArgs>(GeneralButton_Tapped);

            //        deleteButton.Click += DeleteButton_Click;
            //        deleteButton.DataContext = post;
            //        buttonPanel.Children.Add(deleteButton);
            //        buttonCount++;
            //    }
            //}

            //if (!_offline && App.WebSession.IsLoggedIn && App.WebSession.Username.ToLower() == post.AuthorId.ToLower())
            //{
            //    if (post.ModifyPostUrl != null)
            //    {
            //        Button modifyButton = new Button();
            //        ImageBrush modifyButtonImage = new ImageBrush();
            //        modifyButtonImage.ImageSource = new BitmapImage(new Uri("/MitbbsReader;component/Images/edit_roundbutton.png", UriKind.Relative));
            //        modifyButtonImage.Stretch = Stretch.None;
            //        modifyButton.Style = (Style)Application.Current.Resources["ImageButton"];
            //        modifyButton.Content = modifyButtonImage;
            //        modifyButton.Padding = new Thickness(0);
            //        modifyButton.BorderThickness = new Thickness(0);
            //        modifyButton.Margin = new Thickness(0);
            //        modifyButton.Width = buttonSize;
            //        modifyButton.Height = buttonSize;

            //        GestureListener gl2 = GestureService.GetGestureListener(modifyButton);
            //        gl2.Tap += new EventHandler<Microsoft.Phone.Controls.GestureEventArgs>(GeneralButton_Tapped);

            //        modifyButton.Click += ModifyButton_Click;
            //        modifyButton.DataContext = post;
            //        buttonPanel.Children.Add(modifyButton);
            //        buttonCount++;
            //    }
            //}

            //{
            //    Button shareButton = new Button();
            //    ImageBrush shareButtonImage = new ImageBrush();
            //    shareButtonImage.ImageSource = new BitmapImage(new Uri("/MitbbsReader;component/Images/share_roundbutton.png", UriKind.Relative));
            //    shareButtonImage.Stretch = Stretch.None;
            //    shareButton.Style = (Style)Application.Current.Resources["ImageButton"];
            //    shareButton.Content = shareButtonImage;
            //    shareButton.Padding = new Thickness(0);
            //    shareButton.BorderThickness = new Thickness(0);
            //    shareButton.Margin = new Thickness(0);
            //    shareButton.Width = buttonSize;
            //    shareButton.Height = buttonSize;

            //    GestureListener gl2 = GestureService.GetGestureListener(shareButton);
            //    gl2.Tap += new EventHandler<Microsoft.Phone.Controls.GestureEventArgs>(GeneralButton_Tapped);

            //    shareButton.Click += ShareButton_Click;
            //    shareButton.DataContext = post;
            //    buttonPanel.Children.Add(shareButton);
            //    buttonCount++;
            //}

            //if (buttonCount > 0)
            //{
            //    buttonBorder.Width = buttonCount * buttonSize;
            //    headerPanel.Children.Add(buttonBorder);
            //}
            //else
            //{
            //    expandButtonPanel.Visibility = Visibility.Collapsed;
            //}

            _topicBodyPanel.Children.Add(headerPanel);

            // Body
            //
            bool firstContent = true;
            for (int index = 0; index < post.Contents.Count; index++)
            {
                ContentBlock content = post.Contents[index];
                bool isSignature = (post.SignatureStart >= 0) && (index > post.SignatureStart);

                if (content is ImageBlock)
                {
                    String imageUrl = (content as ImageBlock).ImageUrl;

                    try
                    {
                        _imageLoader.LoadImage(
                                        imageUrl,
                                        HtmlUtilities.GetAbsoluteUrl(imageUrl, "/")
                                        );
                    }
                    catch (Exception e)
                    {
                        Debug.WriteLine(e.ToString());
                    }
                }
                else if (content is LinkBlock)
                {
                    String url = (content as LinkBlock).Url;
                    if (MitbbsLinkConverter.IsMitbbsFullTopicLink(url))
                    {
                        Button articleButton = new Button();
                        ImageBrush articleButtonImage = new ImageBrush();
                        articleButtonImage.ImageSource = new BitmapImage(new Uri("/MitbbsReader;component/Images/right_roundbutton.png", UriKind.Relative));
                        articleButtonImage.Stretch = Stretch.Uniform;
                        articleButton.Style = (Style)Application.Current.Resources["ImageButton"];
                        articleButton.Content = articleButtonImage;
                        articleButton.Padding = new Thickness(0);
                        articleButton.BorderThickness = new Thickness(0);
                        articleButton.Margin = new Thickness(0);

                        GestureListener gl2 = GestureService.GetGestureListener(articleButton);
                        gl2.Tap += new EventHandler<Microsoft.Phone.Controls.GestureEventArgs>(GeneralButton_Tapped);

                        articleButton.Click += ArticleButton_Click;
                        articleButton.DataContext = content;

                        HyperlinkButton link = new HyperlinkButton();
                        link.SetValue(TiltEffect.IsTiltEnabledProperty, true);
                        link.Click += GeneralLink_Click;
                        link.DataContext = content;
                        link.Content = "打开未名空间文章";
                        link.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                        link.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left;

                        Border articlePanelBorder = new Border();
                        articlePanelBorder.BorderBrush = (Brush)App.Current.Resources["PhoneForegroundBrush"];
                        articlePanelBorder.BorderThickness = new Thickness(2);

                        if (isSignature)
                        {
                            articleButton.Width = buttonSize * 2 / 3;
                            articleButton.Height = buttonSize * 2 / 3;
                            articleButton.Foreground = (Brush)App.Current.Resources["PhoneSubtleBrush"];
                            link.FontSize = (double)App.Current.Resources["PhoneFontSizeSmall"];
                            link.Foreground = (Brush)App.Current.Resources["PhoneSubtleBrush"];
                            articlePanelBorder.BorderBrush = (Brush)App.Current.Resources["PhoneSubtleBrush"];
                            articlePanelBorder.BorderThickness = new Thickness(1);
                            articlePanelBorder.Width = 300;
                            articlePanelBorder.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                        }
                        else
                        {
                            articleButton.Width = buttonSize;
                            articleButton.Height = buttonSize;
                            link.FontSize = (double)App.Current.Resources["MitbbsFontSizeText"];
                            articlePanelBorder.BorderBrush = (Brush)App.Current.Resources["PhoneForegroundBrush"];
                            articlePanelBorder.BorderThickness = new Thickness(2);
                            articlePanelBorder.Width = 350;
                        }

                        StackPanel articlePanel = new StackPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal };

                        articlePanelBorder.Child = articlePanel;
                        articlePanel.Children.Add(articleButton);
                        articlePanel.Children.Add(link);

                        _topicBodyPanel.Children.Add(articlePanelBorder);
                    }
                    else
                    {
                        HyperlinkButton link = new HyperlinkButton();
                        link.SetValue(TiltEffect.IsTiltEnabledProperty, true);

                        if (isSignature)
                        {
                            link.FontSize = (double)App.Current.Resources["PhoneFontSizeSmall"];
                            link.Foreground = (Brush)App.Current.Resources["PhoneSubtleBrush"];
                        }
                        else
                        {
                            link.FontSize = (double)App.Current.Resources["MitbbsFontSizeText"];
                        }

                        //link.TargetName = "_new";
                        //link.NavigateUri = new Uri((content as LinkBlock).Url, UriKind.Absolute);
                        link.Click += GeneralLink_Click;
                        link.DataContext = content;
                        link.Content = (content as LinkBlock).Text;
                        link.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                        link.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left;
                        _topicBodyPanel.Children.Add(link);
                    }
                }
                else if (content is VideoBlock)
                {
                    Button playButton = new Button();
                    ImageBrush playButtonImage = new ImageBrush();
                    playButtonImage.ImageSource = new BitmapImage(new Uri("/MitbbsReader;component/Images/play_roundbutton.png", UriKind.Relative));
                    playButtonImage.Stretch = Stretch.Uniform;
                    playButton.Style = (Style)Application.Current.Resources["ImageButton"];
                    playButton.Content = playButtonImage;
                    playButton.Padding = new Thickness(0);
                    playButton.BorderThickness = new Thickness(0);
                    playButton.Margin = new Thickness(0);

                    GestureListener gl2 = GestureService.GetGestureListener(playButton);
                    gl2.Tap += new EventHandler<Microsoft.Phone.Controls.GestureEventArgs>(GeneralButton_Tapped);

                    playButton.Click += PlayButton_Click;
                    playButton.DataContext = content;

                    HyperlinkButton link = new HyperlinkButton();
                    link.SetValue(TiltEffect.IsTiltEnabledProperty, true);

                    Border playPanelBorder = new Border();

                    if (isSignature)
                    {
                        playButton.Width = buttonSize * 2 / 3;
                        playButton.Height = buttonSize * 2 / 3;
                        playButton.Foreground = (Brush)App.Current.Resources["PhoneSubtleBrush"];
                        link.FontSize = (double)App.Current.Resources["PhoneFontSizeSmall"];
                        link.Foreground = (Brush)App.Current.Resources["PhoneSubtleBrush"];
                        playPanelBorder.BorderBrush = (Brush)App.Current.Resources["PhoneSubtleBrush"];
                        playPanelBorder.BorderThickness = new Thickness(1);
                        playPanelBorder.Width = 200;
                        playPanelBorder.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                    }
                    else
                    {
                        playButton.Width = buttonSize;
                        playButton.Height = buttonSize;
                        link.FontSize = (double)App.Current.Resources["MitbbsFontSizeText"];
                        playPanelBorder.BorderBrush = (Brush)App.Current.Resources["PhoneForegroundBrush"];
                        playPanelBorder.BorderThickness = new Thickness(2);
                        playPanelBorder.Width = 300;
                    }

                    link.Content = "点击播放视频";
                    link.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                    link.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left;
                    link.DataContext = content;

                    link.Click += VideoLink_Click;

                    StackPanel playPanel = new StackPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal };

                    playPanelBorder.Child = playPanel;
                    playPanel.Children.Add(playButton);
                    playPanel.Children.Add(link);

                    _topicBodyPanel.Children.Add(playPanelBorder);
                }
                else if (content is TextContentBlock)
                {
                    String contentText = (content as TextContentBlock).Text;

                    if (firstContent)
                    {
                        if (!contentText.StartsWith("\n"))
                        {
                            contentText = "\n" + contentText;
                        }

                        firstContent = false;
                    }

                    TextBlock tb = new TextBlock();
                    tb.Text = contentText;
                    tb.TextWrapping = TextWrapping.Wrap;

                    if (content is QuoteBlock)
                    {
                        tb.Style = (Style)App.Current.Resources["PhoneTextSubtleStyle"];
                        tb.FontSize = (double)App.Current.Resources["MitbbsFontSizeNormal"];
                        Border bd = new Border();
                        Thickness bdMgn = new Thickness(0);
                        bdMgn.Left = 20;

                        bd.Margin = bdMgn;
                        bd.BorderThickness = new Thickness(1);
                        bd.CornerRadius = new CornerRadius(8);
                        bd.BorderBrush = (Brush)App.Current.Resources["PhoneSubtleBrush"];

                        bd.Child = tb;
                        _topicBodyPanel.Children.Add(bd);
                    }
                    else
                    {
                        if (isSignature)
                        {
                            tb.Style = (Style)App.Current.Resources["PhoneTextSubtleStyle"];
                            tb.FontSize = (double)App.Current.Resources["MitbbsFontSizeNormal"];
                        }

                        _topicBodyPanel.Children.Add(tb);
                    }
                }
            }

            // Padding
            //
            Grid sep = new Grid();
            sep.Margin = new Thickness(10);

            _topicBodyPanel.Children.Add(sep);
        }
Пример #3
0
        private void SharePost(MitbbsPostBase post)
        {
            if (post != null)
            {
                String postUrl;
                if (post.PostUrl != null)
                {
                    postUrl = post.PostUrl;
                }
                else
                {
                    postUrl = _topic.Url;
                }

                String text = "\n\n" + post.GetText();

                EmailComposeTask emailTask = new EmailComposeTask();

                emailTask.Subject = "FW: " + post.Title;
                emailTask.Body = text;
                emailTask.Show();
            }
        }