Exemple #1
0
 public Profile(TwitterUser user)
 {
     InitializeComponent();
     txtScreenName.Text  = "@" + user.ScreenName;
     txtName.Text        = user.Name;
     txtProfile.Text     = user.Description;
     ImageProfile.Source = WPFHelper.CreateImage(user.ProfileImageUrl);
 }
Exemple #2
0
        /// <summary> Display list of tweets inside the Grid control </summary>
        private void AddResultsToGrid(List <TwitterStatus> StatusList)
        {
            grdTweets.RowDefinitions.Clear();
            grdTweets.Children.Clear();

            foreach (TwitterStatus Status in StatusList)
            {
                grdTweets.RowDefinitions.Add(new RowDefinition()
                {
                    Height = GridLength.Auto
                });

                // Create the text for grid
                TextBlock TextBlock = new TextBlock();
                TextBlock.Margin       = new Thickness(4);
                TextBlock.TextWrapping = TextWrapping.Wrap;

                if (Status.RetweetedStatus != null)
                {
                    TextBlock.Inlines.Add(new Italic(new Run(Environment.NewLine +
                                                             "Retweeted by " +
                                                             Status.User.ScreenName +
                                                             Environment.NewLine)));
                }

                TextBlock.Inlines.AddRange(WPFHelper.CreateInlineTextWithLinks(Status.Text, Hyperlink_RequestNavigate));
                string displayDate = Twitter.ConvertTwitterDateDisplay(Status.CreatedDate);
                TextBlock.Inlines.Add(new Italic(new Run(Environment.NewLine + displayDate)));
                Grid.SetColumn(TextBlock, 1);
                Grid.SetRow(TextBlock, grdTweets.RowDefinitions.Count - 1);
                grdTweets.Children.Add(TextBlock);

                Image ProfileImage = new Image();
                ProfileImage.Source  = WPFHelper.CreateImage(Status.User.ProfileImageUrl);
                ProfileImage.ToolTip = Status.User.Name;
                TwitterUser user = Status.User;

                ProfileImage.MouseDown += (o, e) => {
                    Profile ProfileWindow = new Profile(user);
                    ProfileWindow.ShowDialog();
                };

                Grid.SetColumn(ProfileImage, 0);
                Grid.SetRow(ProfileImage, grdTweets.RowDefinitions.Count - 1);
                grdTweets.Children.Add(ProfileImage);
            }
        }