Пример #1
0
 void HandleBiography()
 {
     try
     {
         using (var pg = new PassageHelper())
         {
             var passages = pg.GetParagraph(ProfileViewModel.UserInfo.Biography, HyperLinkClick);
             txtBiography.Blocks.Clear();
             txtBiography.Blocks.Add(passages);
         }
     }
     catch { var p = new Paragraph(); p.Inlines.Add(new Run()
         {
             Text = ProfileViewModel.UserInfo.Biography
         }); txtBiography.Blocks.Add(p); }
 }
Пример #2
0
 private void ProfileView_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
 {
     try
     {
         if (args.NewValue.GetType() == typeof(ProfileViewModel))
         {
             var context = args.NewValue as ProfileViewModel;
             if (context != null)
             {
                 using (var pg = new PassageHelper())
                 {
                     var passages = pg.GetParagraph(context.UserInfo.Biography, HyperLinkClick);
                     txtBiography.Blocks.Clear();
                     txtBiography.Blocks.Add(passages);
                 }
             }
         }
     } catch { }
 }
Пример #3
0
 void RichTextBlock_Loaded(object sender, RoutedEventArgs e)
 {
     if (sender != null)
     {
         if (sender is RichTextBlock richText && richText != null)
         {
             try
             {
                 if (richText.DataContext is InstaComment comment && comment != null)
                 {
                     using (var pg = new PassageHelper())
                     {
                         var passages = pg.GetParagraph(comment.Text, HyperLinkClick);
                         richText.Blocks.Clear();
                         richText.Blocks.Add(passages);
                     }
                 }
             }
             catch { }
         }
     }
 }
Пример #4
0
        private async void InstaMediaUC_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
        {
            try
            {
                if (args.NewValue.GetType() == typeof(InstaMedia))
                {
                    //var value = DataContext as InstaMedia;
                    switch (Media.MediaType)
                    {
                    case InstaMediaType.Image:
                        break;

                    case InstaMediaType.Carousel:
                        CountIndicator.Text = Media.Carousel.Count.ToString();
                        break;

                    case InstaMediaType.Video:
                        break;
                    }

                    if (Media.Location != null)
                    {
                        _LocationT.Visibility = Visibility.Visible;
                    }

                    if (Media.Caption == null)
                    {
                        txtCaption.Visibility = Visibility.Collapsed;
                    }

                    if (Media.LikesCount == 0)
                    {
                        LikeCount.Visibility = Visibility.Collapsed;
                    }

                    if (Media.CommentsCount == "0")
                    {
                        HyperComment.Visibility = Visibility.Collapsed;
                    }

                    //LikeCount.Text = $"{Media.LikesCount} people like it";
                    //CommentCount.Text = "See all " + Media.CommentsCount + " comments";
                    using (var pg = new PassageHelper())
                    {
                        var passages = pg.GetParagraph(Media.Caption.Text, CaptionHyperLinkClick);
                        txtCaption.Blocks.Clear();
                        txtCaption.Blocks.Add(passages);
                    }


                    await Task.Delay(100);

                    Media.PropertyChanged += Media_PropertyChanged;
                    if (!txtCaption.IsTextTrimmed)
                    {
                        MoreBTN.Visibility = Visibility.Collapsed;
                    }
                    else
                    {
                        MoreBTN.Visibility = Visibility.Visible;
                    }
                }
            }
            catch { }
        }