コード例 #1
0
 //
 private void imageTap(VirtualizableImage obj)
 {
     //long uid = this._mvm.AssociatedUser.uid;
     // if (uid == 0L)
     //    return;
     // Navigator.Current.NavigateToUserProfile(uid, "", "", false);
 }
コード例 #2
0
ファイル: CommentItem.cs プロジェクト: Makzz90/VKClient_re
 private void OnThumbTap(VirtualizableImage obj)
 {
     if (this._tapCommentCallback == null)
     {
         return;
     }
     this._tapCommentCallback(this);
 }
コード例 #3
0
        private void GenerateVirtChildren()
        {
            VirtualizableImage virtualizableImage = new VirtualizableImage(64.0, 64.0, new Thickness(0.0), this._isGroupPost ? this._group.photo_200 : this._user.photo_max, null, "", false, true, Stretch.UniformToFill, null, -1.0, false, true);

            MetroInMotion.SetTilt((DependencyObject)virtualizableImage.View, 1.5);
            Canvas.SetLeft((UIElement)virtualizableImage.View, 16.0);
            Canvas.SetTop((UIElement)virtualizableImage.View, 16.0);
            this.VirtualizableChildren.Add((IVirtualizable)virtualizableImage);
        }
コード例 #4
0
 private void CreateOrUpdateLayout()
 {
     if (this._virtImage == null)
     {
         this._virtImage = new VirtualizableImage(192.0, 192.0, new Thickness((this.Width - 192.0) / 2.0, 16.0, 0.0, 0.0), this._gift.thumb_256, null, "", false, false, (Stretch)3, null, -1.0, false, false);
         this.VirtualizableChildren.Add((IVirtualizable)this._virtImage);
     }
     else
     {
         this._virtImage.Margin = new Thickness((this.Width - 224.0) / 2.0, 16.0, 0.0, 0.0);
     }
 }
コード例 #5
0
ファイル: ThumbsItem.cs プロジェクト: Makzz90/VKClient_re
 private Func <int, Image> GetImageFunc()
 {
     return((Func <int, Image>)(index =>
     {
         if (!this._isMessage)
         {
             VirtualizableImage virtImageByInd = this.FindVirtImageByInd(index);
             if (virtImageByInd != null)
             {
                 return virtImageByInd.ImageControl;
             }
         }
         return null;
     }));
 }
コード例 #6
0
ファイル: ThumbsItem.cs プロジェクト: Makzz90/VKClient_re
        private void ShowHideOverlay(int ind, bool show)
        {
            if (this._isMessage)
            {
                return;
            }
            VirtualizableImage       virtImageByInd       = this.FindVirtImageByInd(ind);
            UCItem                   ucItem               = (virtImageByInd != null ? virtImageByInd.OverlayControl : null) as UCItem;
            UserControlVirtualizable controlVirtualizable = ucItem != null ? ucItem.UC : null;

            if (controlVirtualizable == null)
            {
                return;
            }
            ((UIElement)controlVirtualizable).Opacity = (show ? 1.0 : 0.0);
        }
コード例 #7
0
ファイル: GiftItem.cs プロジェクト: Makzz90/VKClient_re
 private void CreateOrUpdateLayout()
 {
     if (this._virtImage == null)
     {
         Action <VirtualizableImage> callbackOnTap = (Action <VirtualizableImage>)null;
         long stickersProductId = this._gift.stickers_product_id;
         if (stickersProductId != 0L)
         {
             callbackOnTap = (Action <VirtualizableImage>)(image => EventAggregator.Current.Publish((object)new StickersTapEvent(stickersProductId, 0)));
         }
         this._virtImage = new VirtualizableImage(this._fixedHeight, this._fixedHeight, new Thickness((this.Width - this._fixedHeight) / 2.0, 0.0, 0.0, 0.0), this._gift.thumb_256, callbackOnTap, "", false, false, Stretch.UniformToFill, (Brush)null, -1.0, false, false);
         this.VirtualizableChildren.Add((IVirtualizable)this._virtImage);
     }
     else
     {
         this._virtImage.Margin = new Thickness((this.Width - this._fixedHeight) / 2.0, 0.0, 0.0, 0.0);
     }
 }
コード例 #8
0
ファイル: MessageItem.cs プロジェクト: Makzz90/VKClient_re
        private void CreateLayout()
        {
            try
            {
                if (!this.IsSystemMessage)
                {
                    if (!this._isTypingItem)
                    {
                        bool   flag            = !string.IsNullOrWhiteSpace(this._mvm.Message.body);
                        int    num1            = this._mvm.Attachments == null ? 0 : (Enumerable.Any <AttachmentViewModel>(this._mvm.Attachments, (Func <AttachmentViewModel, bool>)(a => a.AttachmentType == AttachmentType.Gift)) ? 1 : 0);
                        double verticalWidth   = 356.0;
                        double horizontalWidth = 512.0;
                        if (num1 != 0 && !flag)
                        {
                            verticalWidth = horizontalWidth = 256.0;
                        }
                        this._messageContentItem = new MessageContentItem(verticalWidth, new Thickness(), this._mvm, horizontalWidth, this._isHorizontalOrientation, 0);
                        MessageDirectionType messageDirectionType = this._mvm.MessageDirectionType;
                        double          width           = this._messageContentItem.Width;
                        SolidColorBrush bgBrush1        = this._mvm.BGBrush;
                        Rectangle       rectangle       = new Rectangle();
                        SolidColorBrush solidColorBrush = bgBrush1;
                        ((Shape)rectangle).Fill = ((Brush)solidColorBrush);
                        double num2 = width;
                        ((FrameworkElement)rectangle).Width = num2;
                        double fixedHeight = this._messageContentItem.FixedHeight;
                        ((FrameworkElement)rectangle).Height = fixedHeight;
                        this._bubbleRect    = rectangle;
                        this._selectionPath = new Path();
                        PathGeometry pathGeometry = new PathGeometry();
                        PathFigure   pathFigure1  = new PathFigure();
                        PathFigure   pathFigure2  = pathFigure1;
                        Point        point1       = new Point();
                        // ISSUE: explicit reference operation
                        point1.X = 361.0;
                        // ISSUE: explicit reference operation
                        point1.Y = 239.0;
                        Point point2 = point1;
                        pathFigure2.StartPoint = point2;
                        LineSegment lineSegment1 = new LineSegment();
                        Point       p1           = new Point();
                        // ISSUE: explicit reference operation
                        p1.X = 371.0;
                        // ISSUE: explicit reference operation
                        p1.Y = 250.0;
                        Point point3 = p1;
                        lineSegment1.Point = point3;
                        LineSegment lineSegment2 = lineSegment1;
                        LineSegment lineSegment3 = new LineSegment();
                        p1 = new Point();
                        // ISSUE: explicit reference operation
                        p1.X = 387.0;
                        // ISSUE: explicit reference operation
                        p1.Y = 230.0;
                        Point point4 = p1;
                        lineSegment3.Point = point4;
                        LineSegment lineSegment4 = lineSegment3;
                        ((PresentationFrameworkCollection <PathSegment>)pathFigure1.Segments).Add((PathSegment)lineSegment2);
                        ((PresentationFrameworkCollection <PathSegment>)pathFigure1.Segments).Add((PathSegment)lineSegment4);
                        ((PresentationFrameworkCollection <PathFigure>)pathGeometry.Figures).Add(pathFigure1);
                        this._selectionPath.Data                       = ((Geometry)pathGeometry);
                        ((Shape)this._selectionPath).Stretch           = ((Stretch)1);
                        ((FrameworkElement)this._selectionPath).Height = 20.5;
                        ((FrameworkElement)this._selectionPath).Width  = 25.667;
                        ((Shape)this._selectionPath).StrokeThickness   = 5.0;
                        ((Shape)this._selectionPath).Stroke            = (Application.Current.Resources["PhoneVKSubtleBrush"] as Brush);
                        ((UIElement)this._selectionPath).Visibility    = this._mvm.SelectionMarkVisibility;
                        switch (messageDirectionType)
                        {
                        case MessageDirectionType.InFromUser:
                            this._messageContentItem.Margin = MessageItem.UserIncomingMessageMargin;
                            ((FrameworkElement)this._selectionPath).Margin = (new Thickness(this._messageContentItem.Width + 10.0, 10.0, 0.0, 0.0));
                            Path            path1    = new Path();
                            SolidColorBrush bgBrush2 = this._mvm.BGBrush;
                            ((Shape)path1).Fill = ((Brush)bgBrush2);
                            double num3 = 16.0;
                            ((FrameworkElement)path1).Height = num3;
                            double num4 = 13.0;
                            ((FrameworkElement)path1).Width = num4;
                            Thickness thickness1 = new Thickness(-12.0, 16.0, 0.0, 0.0);
                            ((FrameworkElement)path1).Margin = thickness1;
                            int num5 = 1;
                            ((Shape)path1).Stretch = ((Stretch)num5);
                            p1 = new Point();
                            Geometry triangleGeometry1 = PathHelper.CreateTriangleGeometry(p1, new Point(100.0, 0.0), new Point(100.0, 100.0));
                            path1.Data        = triangleGeometry1;
                            this._calloutPath = path1;
                            break;

                        case MessageDirectionType.InFromUserInChat:
                            this._messageContentItem.Margin = MessageItem.ChatIncomingMessageMargin;
                            Path      selectionPath1 = this._selectionPath;
                            Thickness margin1        = this._messageContentItem.Margin;
                            // ISSUE: explicit reference operation
                            Thickness thickness2 = new Thickness(margin1.Left + this._messageContentItem.Width + 10.0, 10.0, 0.0, 0.0);
                            ((FrameworkElement)selectionPath1).Margin = thickness2;
                            if (this._mvm.UIImageUrl != null)
                            {
                                base.VirtualizableChildren.Add((IVirtualizable) new VirtualizableImage(48.0, 48.0, new Thickness(), this._mvm.UIImageUrl, (Action <VirtualizableImage>)(vi =>
                                {
                                    if (this._mvm.AssociatedUser == null)
                                    {
                                        return;
                                    }
                                    Navigator.Current.NavigateToUserProfile(this._mvm.AssociatedUser.uid, "", "", false);
                                }), "", true, true, (Stretch)3, null, -1.0, false, true));
                            }
                            ((FrameworkElement)this._bubbleRect).Margin = MessageItem.ChatIncomingMessageMargin;
                            Path            path2    = new Path();
                            SolidColorBrush bgBrush3 = this._mvm.BGBrush;
                            ((Shape)path2).Fill = ((Brush)bgBrush3);
                            double num6 = 16.0;
                            ((FrameworkElement)path2).Height = num6;
                            double num7 = 13.0;
                            ((FrameworkElement)path2).Width = num7;
                            Thickness thickness3 = new Thickness(56.0, 16.0, 0.0, 0.0);
                            ((FrameworkElement)path2).Margin = thickness3;
                            int num8 = 1;
                            ((Shape)path2).Stretch = ((Stretch)num8);
                            p1 = new Point();
                            Geometry triangleGeometry2 = PathHelper.CreateTriangleGeometry(p1, new Point(100.0, 0.0), new Point(100.0, 100.0));
                            path2.Data        = triangleGeometry2;
                            this._calloutPath = path2;
                            break;

                        case MessageDirectionType.OutToUser:
                        case MessageDirectionType.OutToChat:
                            this._messageContentItem.Margin = new Thickness(this.Width - width, 0.0, 0.0, 0.0);
                            Path      selectionPath2 = this._selectionPath;
                            Thickness margin2        = this._messageContentItem.Margin;
                            // ISSUE: explicit reference operation
                            Thickness thickness4 = new Thickness(((Thickness)@margin2).Left - 10.0 - ((FrameworkElement)this._selectionPath).Width, 10.0, 0.0, 0.0);
                            ((FrameworkElement)selectionPath2).Margin = thickness4;
                            Path            path3    = new Path();
                            SolidColorBrush bgBrush4 = this._mvm.BGBrush;
                            ((Shape)path3).Fill = ((Brush)bgBrush4);
                            double num9 = 16.0;
                            ((FrameworkElement)path3).Height = num9;
                            double num10 = 13.0;
                            ((FrameworkElement)path3).Width = num10;
                            Thickness thickness5 = new Thickness(this.Width - 1.0, 16.0, 0.0, 0.0);
                            ((FrameworkElement)path3).Margin = thickness5;
                            int num11 = 1;
                            ((Shape)path3).Stretch = ((Stretch)num11);
                            p1 = new Point();
                            Geometry triangleGeometry3 = PathHelper.CreateTriangleGeometry(p1, new Point(100.0, 0.0), new Point(0.0, 100.0));
                            path3.Data        = triangleGeometry3;
                            this._calloutPath = path3;
                            ((FrameworkElement)this._bubbleRect).Margin = (new Thickness(this.Width - width, 0.0, 0.0, 0.0));
                            break;

                        case MessageDirectionType.Undefined:
                            return;
                        }
                        base.VirtualizableChildren.Add((IVirtualizable)this._messageContentItem);
                        this._height         = this._messageContentItem.FixedHeight;
                        this._tapHandlerItem = new TapHandlerItem(this.Width, this._height, this._mvm);
                        base.VirtualizableChildren.Add((IVirtualizable)this._tapHandlerItem);
                    }
                    else
                    {
                        this._height = 52.0;
                        SolidColorBrush bgBrush1 = this._mvm.BGBrush;
                        this._selectionPath = new Path();
                        Rectangle       rectangle       = new Rectangle();
                        SolidColorBrush solidColorBrush = bgBrush1;
                        ((Shape)rectangle).Fill = ((Brush)solidColorBrush);
                        double num1 = 80.0;
                        ((FrameworkElement)rectangle).Width = num1;
                        double num2 = 52.0;
                        ((FrameworkElement)rectangle).Height = num2;
                        this._bubbleRect = rectangle;
                        VirtualizableImage virtualizableImage1 = new VirtualizableImage(48.0, 12.0, new Thickness(16.0, 22.0, 0.0, 0.0), MultiResolutionHelper.Instance.AppendResolutionSuffix("/Resources/New/TypingBubbleDots.png", true, ""), null, null, false, false, (Stretch)3, null, -1.0, false, false);
                        base.VirtualizableChildren.Add((IVirtualizable)virtualizableImage1);
                        if (this._isTypingInChat)
                        {
                            ((FrameworkElement)this._bubbleRect).Margin = MessageItem.ChatIncomingMessageMargin;
                            VirtualizableImage virtualizableImage2 = virtualizableImage1;
                            Thickness          margin1             = virtualizableImage1.Margin;
                            // ISSUE: explicit reference operation
                            double left1 = margin1.Left;
                            margin1 = ((FrameworkElement)this._bubbleRect).Margin;
                            // ISSUE: explicit reference operation
                            double    left2      = margin1.Left;
                            double    num3       = left1 + left2;
                            Thickness thickness1 = virtualizableImage1.Margin;
                            // ISSUE: explicit reference operation
                            double top1 = ((Thickness)@thickness1).Top;
                            thickness1 = ((FrameworkElement)this._bubbleRect).Margin;
                            // ISSUE: explicit reference operation
                            double    top2       = ((Thickness)@thickness1).Top;
                            double    num4       = top1 + top2;
                            double    num5       = 0.0;
                            double    num6       = 0.0;
                            Thickness thickness2 = new Thickness(num3, num4, num5, num6);
                            virtualizableImage2.Margin = thickness2;
                            Path            path     = new Path();
                            SolidColorBrush bgBrush2 = this._mvm.BGBrush;
                            ((Shape)path).Fill = ((Brush)bgBrush2);
                            double num7 = 16.0;
                            ((FrameworkElement)path).Height = num7;
                            double num8 = 13.0;
                            ((FrameworkElement)path).Width = num8;
                            Thickness thickness3 = new Thickness(56.0, 16.0, 0.0, 0.0);
                            ((FrameworkElement)path).Margin = thickness3;
                            int num9 = 1;
                            ((Shape)path).Stretch = ((Stretch)num9);
                            Geometry triangleGeometry = PathHelper.CreateTriangleGeometry(new Point(), new Point(100.0, 0.0), new Point(100.0, 100.0));
                            path.Data         = triangleGeometry;
                            this._calloutPath = path;
                            if (this._userTyping == null || this._userTyping.photo_max == null)
                            {
                                return;
                            }
                            double width  = 52.0;
                            double height = 52.0;
                            thickness1 = new Thickness();
                            Thickness margin2  = thickness1;
                            string    photoMax = this._userTyping.photo_max;
                            Action <VirtualizableImage> callbackOnTap = (Action <VirtualizableImage>)(vi =>
                            {
                                if (this._mvm.AssociatedUser == null)
                                {
                                    return;
                                }
                                Navigator.Current.NavigateToUserProfile(this._mvm.AssociatedUser.uid, "", "", false);
                            });
                            string tag   = "";
                            int    num10 = 1;
                            int    num11 = 1;
                            int    num12 = 3;
                            // ISSUE: variable of the null type

                            double placeholderOpacity = -1.0;
                            int    num13 = 0;
                            int    num14 = 1;
                            base.VirtualizableChildren.Add((IVirtualizable) new VirtualizableImage(width, height, margin2, photoMax, callbackOnTap, tag, num10 != 0, num11 != 0, (Stretch)num12, null, placeholderOpacity, num13 != 0, num14 != 0));
                        }
                        else
                        {
                            Path            path     = new Path();
                            SolidColorBrush bgBrush2 = this._mvm.BGBrush;
                            ((Shape)path).Fill = ((Brush)bgBrush2);
                            double num3 = 16.0;
                            ((FrameworkElement)path).Height = num3;
                            double num4 = 13.0;
                            ((FrameworkElement)path).Width = num4;
                            Thickness thickness = new Thickness(-12.0, 16.0, 0.0, 0.0);
                            ((FrameworkElement)path).Margin = thickness;
                            int num5 = 1;
                            ((Shape)path).Stretch = ((Stretch)num5);
                            Geometry triangleGeometry = PathHelper.CreateTriangleGeometry(new Point(), new Point(100.0, 0.0), new Point(100.0, 100.0));
                            path.Data         = triangleGeometry;
                            this._calloutPath = path;
                        }
                    }
                }
                else
                {
                    this._systemMessageItem = new SystemMessageItem(MessageItem.VERTICAL_WIDTH, new Thickness(), this._mvm, MessageItem.HORIZONTAL_WIDTH, this._isHorizontalOrientation);
                    this._height            = this._systemMessageItem.FixedHeight;
                    base.VirtualizableChildren.Add((IVirtualizable)this._systemMessageItem);
                }
            }
            catch (Exception)
            {
                Logger.Instance.Error("Failed to create message layout!!");
            }
        }
コード例 #9
0
ファイル: ThumbsItem.cs プロジェクト: Makzz90/VKClient_re
        public void Image_Tap(VirtualizableImage source = null)
        {
            if (source == null)
            {
                source = Enumerable.FirstOrDefault <IVirtualizable>(this.VirtualizableChildren) as VirtualizableImage;
                if (source == null || source.Tag == null)
                {
                    return;
                }
            }
            int selectedPhotoIndex = int.Parse(source.Tag);

            if (this.ItemType == ThumbsItem.ItemDataType.Attachment)
            {
                List <Attachment> list1 = (List <Attachment>)Enumerable.ToList <Attachment>(Enumerable.OrderBy <Attachment, bool>(this._attachments, (Func <Attachment, bool>)(at =>
                {
                    if (at.doc == null)
                    {
                        return(false);
                    }
                    DocPreview preview = at.doc.preview;
                    return((preview != null ? preview.video : null) == null);
                })));
                Attachment attachment = list1[selectedPhotoIndex];
                if (attachment.type == "photo" || attachment.type == "doc")
                {
                    List <PhotoOrDocument> list = new List <PhotoOrDocument>();
                    int  selectedIndex          = 0;
                    bool flag = false;
                    IEnumerator <Attachment> enumerator = ((IEnumerable <Attachment>)Enumerable.Where <Attachment>(list1, (Func <Attachment, bool>)(at =>
                    {
                        if (at.photo == null)
                        {
                            return(at.doc != null);
                        }
                        return(true);
                    }))).GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            Attachment current = enumerator.Current;
                            if (current == attachment)
                            {
                                selectedIndex = list.Count;
                            }
                            if (current.doc != null)
                            {
                                flag = true;
                            }
                            list.Add(new PhotoOrDocument()
                            {
                                document = current.doc,
                                photo    = current.photo
                            });
                        }
                    }
                    finally
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                    if (flag)
                    {
                        InplaceGifViewerUC gifViewer = new InplaceGifViewerUC();
                        if (this._isCommentThumbItem)
                        {
                            CurrentMediaSource.GifPlaySource = StatisticsActionSource.comments;
                        }
                        else if (this._isMessage)
                        {
                            CurrentMediaSource.GifPlaySource = StatisticsActionSource.messages;
                        }
                        // ISSUE: method pointer
                        Navigator.Current.NavigateToImageViewerPhotosOrGifs(selectedIndex, list, false, this._friendsOnly, this.GetImageFunc(), null, false, (FrameworkElement)gifViewer, (Action <int>)(ind =>
                        {
                            Doc document = list[ind].document;
                            if (document != null)
                            {
                                InplaceGifViewerViewModel gifViewerViewModel = new InplaceGifViewerViewModel(document, true, true, false);
                                gifViewerViewModel.Play(GifPlayStartType.manual);
                                gifViewer.VM = gifViewerViewModel;
                                ((UIElement)gifViewer).Visibility = Visibility.Visible;
                            }
                            else
                            {
                                InplaceGifViewerViewModel vm = gifViewer.VM;
                                if (vm != null)
                                {
                                    vm.Stop();
                                }
                                ((UIElement)gifViewer).Visibility = Visibility.Collapsed;
                            }
                        }), new Action <int, bool>(this.ShowHideOverlay), false);
                    }
                    else
                    {
                        Navigator.Current.NavigateToImageViewer(this.PhotosCount, 0, this.PhotosListFromAttachments.IndexOf(attachment.photo), (List <long>)Enumerable.ToList <long>(Enumerable.Select <Photo, long>(this.PhotosListFromAttachments, (Func <Photo, long>)(p => p.pid))), (List <long>)Enumerable.ToList <long>(Enumerable.Select <Photo, long>(this.PhotosListFromAttachments, (Func <Photo, long>)(p => p.owner_id))), (List <string>)Enumerable.ToList <string>(Enumerable.Select <Photo, string>(this.PhotosListFromAttachments, (Func <Photo, string>)(p => p.access_key ?? ""))), this.PhotosListFromAttachments, "PhotosByIds", false, this._friendsOnly, this.GetImageFunc(), null, false);
                    }
                    if (!(attachment.type == "photo") || this._parentPostId == null)
                    {
                        return;
                    }
                    StatsEventsTracker.Instance.Handle(new PostActionEvent()
                    {
                        PostId     = this._parentPostId,
                        ActionType = PostActionType.PhotoOpened
                    });
                }
                else if (attachment.type == "video")
                {
                    if (attachment.video.owner_id == 0L || attachment.video.vid == 0L)
                    {
                        return;
                    }
                    if (this._isCommentThumbItem)
                    {
                        CurrentMediaSource.VideoSource  = StatisticsActionSource.comments;
                        CurrentMediaSource.VideoContext = this._itemId;
                    }
                    else if (this._isMessage)
                    {
                        CurrentMediaSource.VideoSource  = StatisticsActionSource.messages;
                        CurrentMediaSource.VideoContext = this._itemId;
                    }
                    else if (CurrentMediaSource.VideoSource == StatisticsActionSource.news)
                    {
                        CurrentMediaSource.VideoContext = this._itemId;
                    }
                    else if (CurrentMediaSource.VideoSource == StatisticsActionSource.wall_user || CurrentMediaSource.VideoSource == StatisticsActionSource.wall_group)
                    {
                        CurrentMediaSource.VideoContext = string.Concat(CurrentMediaSource.VideoContext, "|", this._itemId);
                    }
                    Navigator.Current.NavigateToVideoWithComments(attachment.video.guid == Guid.Empty ? attachment.video : null, attachment.video.owner_id, attachment.video.vid, attachment.video.access_key);
                    if (this._parentPostId == null)
                    {
                        return;
                    }
                    StatsEventsTracker.Instance.Handle(new PostActionEvent()
                    {
                        PostId     = this._parentPostId,
                        ActionType = PostActionType.VideoOpened
                    });
                }
                else if (attachment.type == "album")
                {
                    Album album = attachment.album;
                    if (album == null)
                    {
                        return;
                    }
                    AlbumType albumType = AlbumTypeHelper.GetAlbumType(album.aid);
                    Navigator.Current.NavigateToPhotoAlbum(Math.Abs(long.Parse(album.owner_id)), long.Parse(album.owner_id) < 0, albumType.ToString(), album.aid, "", 0, "", "", false, 0, false);
                }
                else
                {
                    if (!(attachment.type == "market_album"))
                    {
                        return;
                    }
                    MarketAlbum marketAlbum = attachment.market_album;
                    if (marketAlbum == null)
                    {
                        return;
                    }
                    Navigator.Current.NavigateToMarketAlbumProducts(marketAlbum.owner_id, marketAlbum.id, marketAlbum.title);
                }
            }
            else
            {
                if (this.ItemType != ThumbsItem.ItemDataType.NewsPhotosInfo || this._newsPhotosInfo.Photos.Count <= 0)
                {
                    return;
                }
                Navigator.Current.NaviateToImageViewerPhotoFeed(Math.Abs(this._newsPhotosInfo.SourceId), this._newsPhotosInfo.SourceId < 0, ((Photo)Enumerable.First <Photo>(this._newsPhotosInfo.Photos)).aid.ToString(), this._newsPhotosInfo.Count, selectedPhotoIndex, this._newsPhotosInfo.Date, this._newsPhotosInfo.Photos, this._newsPhotosInfo.NewsType == NewsPhotosInfo.NewsPhotoType.Photo ? "Photos" : "PhotoTags", this.GetImageFunc());
            }
        }
コード例 #10
0
ファイル: ThumbsItem.cs プロジェクト: Makzz90/VKClient_re
        private void CreateOrUpdateLayout()
        {
            foreach (IVirtualizable virtualizableChild in (Collection <IVirtualizable>) this.VirtualizableChildren)
            {
                virtualizableChild.ChangeState(VirtualizableState.Unloaded);
            }
            this.VirtualizableChildren.Clear();
            if (this._thumbs.Count == 0)
            {
                return;
            }
            List <Rect> layout = RectangleLayoutHelper.CreateLayout(new Size(this.Width, this.DesiredHeight), this._thumbs.Select <ThumbsItem.Thumb, Size>((Func <ThumbsItem.Thumb, Size>)(t => new Size(t.Width, t.Height))).ToList <Size>(), 4.0);

            layout.Max <Rect>((Func <Rect, double>)(r => r.Left + r.Width));
            int index = 0;

            foreach (Rect rect1 in layout)
            {
                Rect               rect           = rect1;
                Thickness          margin         = new Thickness(rect.Left, rect.Top, 0.0, 0.0);
                ThumbsItem.Thumb   currentThumb   = this._thumbs[index];
                bool               blackRectOnTop = !string.IsNullOrEmpty(currentThumb.Label);
                bool               flag           = !string.IsNullOrEmpty(currentThumb.LabelLarge);
                VirtualizableImage virtImage      = new VirtualizableImage(rect.Width, rect.Height, margin, currentThumb.GetProperSrc(rect.Width, rect.Height), new Action <VirtualizableImage>(this.Image_Tap), index.ToString(), false, !this._isMessage, Stretch.UniformToFill, (Brush)null, -1.0, blackRectOnTop, false);
                this.VirtualizableChildren.Add((IVirtualizable)virtImage);
                if (currentThumb.Video != null)
                {
                    this.VirtualizableChildren.Add((IVirtualizable) new UCItem(rect.Width, margin, (Func <UserControlVirtualizable>)(() =>
                    {
                        return((UserControlVirtualizable) new VideoNewsItemDescUC()
                        {
                            Width = rect.Width,
                            Height = rect.Height,
                            DataContext = (object)new VideoNewsItemDescViewModel(currentThumb.Video, rect.Width > 460.0)
                        });
                    }), (Func <double>)(() => rect.Height), (Action <UserControlVirtualizable>)null, 0.0, false));
                    virtImage.Tag2 = "NotAPreview";
                }
                else if (currentThumb.GifDoc != null)
                {
                    UCItem ucItem = new UCItem(rect.Width, margin, (Func <UserControlVirtualizable>)(() =>
                    {
                        bool isOneItem = layout.Count == 1;
                        InplaceGifViewerViewModel gifViewerViewModel = new InplaceGifViewerViewModel(currentThumb.GifDoc, false, this._isCommentThumbItem || this._isMessage, isOneItem);
                        if (isOneItem)
                        {
                            return (UserControlVirtualizable) new InplaceGifViewerUC()
                            {
                                Width        = rect.Width,
                                Height       = rect.Height,
                                VM           = gifViewerViewModel,
                                gifOverlayUC =
                                {
                                    OnTap = (Action)(() => this.Image_Tap(virtImage))
                                }
                            }
                        }
                        ;
                        return((UserControlVirtualizable) new GifOverlayUC()
                        {
                            Width = rect.Width,
                            Height = rect.Height,
                            DataContext = (object)gifViewerViewModel,
                            OnTap = (Action)(() => this.Image_Tap(virtImage))
                        });
                    }), (Func <double>)(() => rect.Height), (Action <UserControlVirtualizable>)null, 0.0, false);
                    virtImage.OverlayControl = (object)ucItem;
                    this.VirtualizableChildren.Add((IVirtualizable)ucItem);
                }
                else if (currentThumb.Album != null || currentThumb.MarketAlbum != null)
                {
                    this.VirtualizableChildren.Add((IVirtualizable) new UCItem(rect.Width, margin, (Func <UserControlVirtualizable>)(() =>
                    {
                        return((UserControlVirtualizable) new AlbumNewsItemDescUC()
                        {
                            Width = rect.Width,
                            Height = rect.Height,
                            DataContext = (object)(currentThumb.Album != null ? new AlbumNewsItemDescViewModel(currentThumb.Album, rect.Width > 460.0) : new AlbumNewsItemDescViewModel(currentThumb.MarketAlbum, rect.Width > 460.0))
                        });
                    }), (Func <double>)(() => rect.Height), (Action <UserControlVirtualizable>)null, 0.0, false));
                    virtImage.Tag2 = "NotAPreview";
                }
                else if (blackRectOnTop)
                {
                    if (flag)
                    {
                        this.VirtualizableChildren.Add((IVirtualizable) new TextItem(rect.Width - 12.0, new Thickness(rect.Left + 12.0, rect.Top + rect.Height - 69.0, 0.0, 0.0), this._thumbs[index].LabelLarge, false, 25.33, "Segoe WP", 27.0, new SolidColorBrush(Colors.White), false, null));
                        double          width      = rect.Width - 12.0;
                        Thickness       textMargin = new Thickness(rect.Left + 12.0, rect.Top + rect.Height - 37.0, 0.0, 0.0);
                        string          label      = this._thumbs[index].Label;
                        int             num1       = 0;
                        double          fontSize   = 20.0;
                        string          fontFamily = "Segoe WP";
                        double          lineHeight = 22.0;
                        SolidColorBrush foreground = new SolidColorBrush(Colors.White);
                        double          num2       = 0.6;
                        foreground.Opacity = num2;
                        int    num3  = 0;
                        object local = null;
                        this.VirtualizableChildren.Add((IVirtualizable) new TextItem(width, textMargin, label, num1 != 0, fontSize, fontFamily, lineHeight, foreground, num3 != 0, (Action)local));
                    }
                    else
                    {
                        this.VirtualizableChildren.Add((IVirtualizable) new TextItem(rect.Width - 12.0, new Thickness(rect.Left + 12.0, rect.Top + rect.Height - 37.0, 0.0, 0.0), this._thumbs[index].Label, false, 20.0, "Segoe WP", 22.0, new SolidColorBrush(Colors.White), false, null));
                    }
                    virtImage.Tag2 = "NotAPreview";
                }
                ++index;
            }
            if (this.CurrentState != VirtualizableState.Unloaded)
            {
                foreach (IVirtualizable virtualizableChild in (Collection <IVirtualizable>) this.VirtualizableChildren)
                {
                    virtualizableChild.ChangeState(this.CurrentState);
                }
            }
            double num;

            if (layout.Count <= 0)
            {
                num = 0.0;
            }
            else
            {
                Rect   rect = layout.Last <Rect>();
                double top  = rect.Top;
                rect = layout.Last <Rect>();
                double height = rect.Height;
                num = top + height;
            }
            this._height = num;
        }
コード例 #11
0
        public void Image_Tap(VirtualizableImage source = null)
        {
            if (source == null)
            {
                source = this.VirtualizableChildren.FirstOrDefault <IVirtualizable>() as VirtualizableImage;
                if (source == null || source.Tag == null)
                {
                    return;
                }
            }
            int selectedPhotoIndex = int.Parse(source.Tag);

            if (this.ItemType == ThumbsItem.ItemDataType.Attachment)
            {
                List <Attachment> list1 = this._attachments.OrderBy <Attachment, bool>((Func <Attachment, bool>)(at =>
                {
                    if (at.doc == null)
                    {
                        return(false);
                    }
                    DocPreview preview = at.doc.preview;
                    return((preview != null ? preview.video : (DocPreviewVideo)null) == null);
                })).ToList <Attachment>();
                Attachment attachment1 = list1[selectedPhotoIndex];
                if (attachment1.type == "photo" || attachment1.type == "doc")
                {
                    List <PhotoOrDocument> list = new List <PhotoOrDocument>();
                    int  selectedIndex          = 0;
                    bool flag = false;
                    foreach (Attachment attachment2 in list1.Where <Attachment>((Func <Attachment, bool>)(at =>
                    {
                        if (at.photo == null)
                        {
                            return(at.doc != null);
                        }
                        return(true);
                    })))
                    {
                        if (attachment2 == attachment1)
                        {
                            selectedIndex = list.Count;
                        }
                        if (attachment2.doc != null)
                        {
                            flag = true;
                        }
                        list.Add(new PhotoOrDocument()
                        {
                            document = attachment2.doc,
                            photo    = attachment2.photo
                        });
                    }
                    if (flag)
                    {
                        InplaceGifViewerUC gifViewer = new InplaceGifViewerUC();
                        if (this._isCommentThumbItem)
                        {
                            CurrentMediaSource.GifPlaySource = StatisticsActionSource.comments;
                        }
                        else if (this._isMessage)
                        {
                            CurrentMediaSource.GifPlaySource = StatisticsActionSource.messages;
                        }
                        Navigator.Current.NavigateToImageViewerPhotosOrGifs(selectedIndex, list, false, this._friendsOnly, this.GetImageFunc(), (PageBase)null, false, (FrameworkElement)gifViewer, (Action <int>)(ind =>
                        {
                            Doc document = list[ind].document;
                            if (document != null)
                            {
                                InplaceGifViewerViewModel gifViewerViewModel = new InplaceGifViewerViewModel(document, true, true, false);
                                gifViewerViewModel.Play(GifPlayStartType.manual);
                                gifViewer.VM         = gifViewerViewModel;
                                gifViewer.Visibility = Visibility.Visible;
                            }
                            else
                            {
                                InplaceGifViewerViewModel vm = gifViewer.VM;
                                if (vm != null)
                                {
                                    vm.Stop();
                                }
                                gifViewer.Visibility = Visibility.Collapsed;
                            }
                        }), new Action <int, bool>(this.ShowHideOverlay), false);
                    }
                    else
                    {
                        Navigator.Current.NavigateToImageViewer(this.PhotosCount, 0, this.PhotosListFromAttachments.IndexOf(attachment1.photo), this.PhotosListFromAttachments.Select <Photo, long>((Func <Photo, long>)(p => p.pid)).ToList <long>(), this.PhotosListFromAttachments.Select <Photo, long>((Func <Photo, long>)(p => p.owner_id)).ToList <long>(), this.PhotosListFromAttachments.Select <Photo, string>((Func <Photo, string>)(p => p.access_key ?? "")).ToList <string>(), this.PhotosListFromAttachments, "PhotosByIds", false, this._friendsOnly, this.GetImageFunc(), (PageBase)null, false);
                    }
                }
                else if (attachment1.type == "video")
                {
                    if (attachment1.video.owner_id == 0L || attachment1.video.vid == 0L)
                    {
                        return;
                    }
                    if (this._isCommentThumbItem)
                    {
                        CurrentMediaSource.VideoSource  = StatisticsActionSource.comments;
                        CurrentMediaSource.VideoContext = this._itemId;
                    }
                    else if (this._isMessage)
                    {
                        CurrentMediaSource.VideoSource  = StatisticsActionSource.messages;
                        CurrentMediaSource.VideoContext = this._itemId;
                    }
                    else if (CurrentMediaSource.VideoSource == StatisticsActionSource.news)
                    {
                        CurrentMediaSource.VideoContext = this._itemId;
                    }
                    else if (CurrentMediaSource.VideoSource == StatisticsActionSource.wall_user || CurrentMediaSource.VideoSource == StatisticsActionSource.wall_group)
                    {
                        CurrentMediaSource.VideoContext = CurrentMediaSource.VideoContext + "|" + this._itemId;
                    }
                    Navigator.Current.NavigateToVideoWithComments(attachment1.video.guid == Guid.Empty ? attachment1.video : null, attachment1.video.owner_id, attachment1.video.vid, attachment1.video.access_key);
                }
                else if (attachment1.type == "album")
                {
                    Album album = attachment1.album;
                    if (album == null)
                    {
                        return;
                    }
                    AlbumType albumType = AlbumTypeHelper.GetAlbumType(album.aid);
                    Navigator.Current.NavigateToPhotoAlbum(Math.Abs(long.Parse(album.owner_id)), long.Parse(album.owner_id) < 0L, albumType.ToString(), album.aid, "", 0, "", "", false, 0);
                }
                else
                {
                    if (!(attachment1.type == "market_album"))
                    {
                        return;
                    }
                    MarketAlbum marketAlbum = attachment1.market_album;
                    if (marketAlbum == null)
                    {
                        return;
                    }
                    Navigator.Current.NavigateToMarketAlbumProducts(marketAlbum.owner_id, marketAlbum.id, marketAlbum.title);
                }
            }
            else
            {
                if (this.ItemType != ThumbsItem.ItemDataType.NewsPhotosInfo || this._newsPhotosInfo.Photos.Count <= 0)
                {
                    return;
                }
                Navigator.Current.NaviateToImageViewerPhotoFeed(Math.Abs(this._newsPhotosInfo.SourceId), this._newsPhotosInfo.SourceId < 0L, this._newsPhotosInfo.Photos.First <Photo>().aid.ToString(), this._newsPhotosInfo.Count, selectedPhotoIndex, this._newsPhotosInfo.Date, this._newsPhotosInfo.Photos, this._newsPhotosInfo.NewsType == NewsPhotosInfo.NewsPhotoType.Photo ? "Photos" : "PhotoTags", this.GetImageFunc());
            }
        }
コード例 #12
0
ファイル: CommentItem.cs プロジェクト: Makzz90/VKClient_re
 private void AvaTap(VirtualizableImage obj)
 {
     this.NavigateToSource();
 }