예제 #1
0
        private void cmbRichiesta_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataRowView row  = (DataRowView)cmbRichiesta.SelectedItem;
            string      path = @"file:///" + row["NomeFile"];

            DocPreview.Navigate(path);
        }
예제 #2
0
        public long GetSize()
        {
            DocPreview preview = this.Document.preview;
            long?      nullable;

            if (preview == null)
            {
                nullable = new long?();
            }
            else
            {
                DocPreviewVideo video = preview.video;
                nullable = video != null ? new long?(video.file_size) : new long?();
            }
            return(nullable ?? this.Document.size);
        }
예제 #3
0
        public GraffitiAttachmentItem(string uri, int width, int height)
        {
            this._uri    = uri;
            this._width  = width;
            this._height = height;
            Doc                doc                = new Doc();
            DocPreview         docPreview         = new DocPreview();
            DocPreviewGraffiti docPreviewGraffiti = new DocPreviewGraffiti();

            docPreviewGraffiti.width  = width;
            docPreviewGraffiti.height = height;
            string uri1 = this._uri;

            docPreviewGraffiti.src = uri1;
            docPreview.graffiti    = docPreviewGraffiti;
            doc.preview            = docPreview;
            this.Doc = doc;
        }
예제 #4
0
        public void Handle(VoiceMessageUploaded message)
        {
            Doc voiceMessageDoc = message.VoiceMessageDoc;

            if (this._doc == null || this._doc.guid == Guid.Empty || this._doc.guid != voiceMessageDoc.guid)
            {
                return;
            }
            DocPreview preview = this._doc.preview;
            string     str1;

            if (preview == null)
            {
                str1 = null;
            }
            else
            {
                DocPreviewVoiceMessage audioMsg = preview.audio_msg;
                str1 = audioMsg != null ? audioMsg.link_ogg :  null;
            }
            string str2 = str1;

            if (string.IsNullOrEmpty(str2))
            {
                return;
            }
            if (VoiceMessagePlayer.PlayerWrapper.CurrentOriginalSource == this._sourceUriStr)
            {
                VoiceMessagePlayer.PlayerWrapper.CurrentOriginalSource = str2;
            }
            this._sourceUriStr = str2;
            int size = (int)this._doc.size;

            if (!string.IsNullOrEmpty(this._wavFileName))
            {
                MediaLRUCache.Instance.AddLocalFile(this._sourceUriStr, this._wavFileName, size);
            }
            this._docOwnerId = voiceMessageDoc.owner_id;
            this._docId      = voiceMessageDoc.id;
        }
예제 #5
0
        public long GetSize()
        {
            DocPreview preview = this.Document.preview;
            long?      nullable1;

            if (preview == null)
            {
                nullable1 = new long?();
            }
            else
            {
                DocPreviewVideo video = preview.video;
                nullable1 = video != null ? new long?(video.file_size) : new long?();
            }
            long?nullable2 = nullable1;

            if (!nullable2.HasValue)
            {
                return(this.Document.size);
            }
            return(nullable2.GetValueOrDefault());
        }
예제 #6
0
 private void PrepareDoc()
 {
     try
     {
         Doc  doc  = new Doc();
         Guid guid = Guid.NewGuid();
         doc.guid = guid;
         DocPreview             docPreview          = new DocPreview();
         DocPreviewVoiceMessage previewVoiceMessage = new DocPreviewVoiceMessage();
         previewVoiceMessage.link_ogg = this._filePath;
         previewVoiceMessage.link_mp3 = this._filePath;
         previewVoiceMessage.duration = this._duration;
         List <int> waveform = this._waveform;
         previewVoiceMessage.waveform = waveform;
         docPreview.audio_msg         = previewVoiceMessage;
         doc.preview   = docPreview;
         this.SavedDoc = doc;
     }
     catch (Exception ex)
     {
         Logger.Instance.Error("Failed to prepare doc data", ex);
     }
 }
예제 #7
0
        public Photo ConvertToPhotoPreview()
        {
            Photo      photo1   = new Photo();
            DocPreview preview1 = this.preview;
            string     str;

            if (preview1 == null)
            {
                str = null;
            }
            else
            {
                DocPreviewPhoto photo2 = preview1.photo;
                if (photo2 == null)
                {
                    str = null;
                }
                else
                {
                    List <DocPreviewPhotoSize> sizes = photo2.sizes;
                    if (sizes == null)
                    {
                        str = null;
                    }
                    else
                    {
                        DocPreviewPhotoSize previewPhotoSize = sizes.LastOrDefault <DocPreviewPhotoSize>();
                        str = previewPhotoSize != null ? previewPhotoSize.src :  null;
                    }
                }
            }
            photo1.src_xbig = str;
            DocPreview preview2 = this.preview;
            int?       nullable1;

            if (preview2 == null)
            {
                nullable1 = new int?();
            }
            else
            {
                DocPreviewPhoto photo2 = preview2.photo;
                if (photo2 == null)
                {
                    nullable1 = new int?();
                }
                else
                {
                    List <DocPreviewPhotoSize> sizes = photo2.sizes;
                    if (sizes == null)
                    {
                        nullable1 = new int?();
                    }
                    else
                    {
                        DocPreviewPhotoSize previewPhotoSize = sizes.LastOrDefault <DocPreviewPhotoSize>();
                        nullable1 = previewPhotoSize != null ? new int?(previewPhotoSize.width) : new int?();
                    }
                }
            }
            int?nullable2 = nullable1;
            int num1      = nullable2 ?? 0;

            photo1.width = num1;
            DocPreview preview3 = this.preview;
            int?       nullable3;

            if (preview3 == null)
            {
                nullable3 = new int?();
            }
            else
            {
                DocPreviewPhoto photo2 = preview3.photo;
                if (photo2 == null)
                {
                    nullable3 = new int?();
                }
                else
                {
                    List <DocPreviewPhotoSize> sizes = photo2.sizes;
                    if (sizes == null)
                    {
                        nullable3 = new int?();
                    }
                    else
                    {
                        DocPreviewPhotoSize previewPhotoSize = sizes.LastOrDefault <DocPreviewPhotoSize>();
                        nullable3 = previewPhotoSize != null ? new int?(previewPhotoSize.height) : new int?();
                    }
                }
            }
            nullable2 = nullable3;
            int num2 = nullable2 ?? 0;

            photo1.height = num2;
            return(photo1);
        }
예제 #8
0
        public void CreateOrUpdateLayout()
        {
            List <Attachment>  source = this._attachments;
            DocPreviewGraffiti docPreviewGraffiti1;

            if (source == null)
            {
                docPreviewGraffiti1 = (DocPreviewGraffiti)null;
            }
            else
            {
                Attachment attachment = source.FirstOrDefault <Attachment>((Func <Attachment, bool>)(a => a.doc != null));
                if (attachment == null)
                {
                    docPreviewGraffiti1 = (DocPreviewGraffiti)null;
                }
                else
                {
                    Doc doc = attachment.doc;
                    if (doc == null)
                    {
                        docPreviewGraffiti1 = (DocPreviewGraffiti)null;
                    }
                    else
                    {
                        DocPreview preview = doc.preview;
                        docPreviewGraffiti1 = preview != null ? preview.graffiti : (DocPreviewGraffiti)null;
                    }
                }
            }
            DocPreviewGraffiti docPreviewGraffiti2 = docPreviewGraffiti1;

            if (docPreviewGraffiti2 == null)
            {
                return;
            }
            double num1 = 4.0 / 9.0;
            double val1 = (double)docPreviewGraffiti2.width * num1;
            double num2 = (double)docPreviewGraffiti2.height * num1;
            double num3 = val1 * 1.0 / num2;
            double num4 = Math.Min(val1, 320.0);
            double num5 = num4 / num3;

            this._width  = num4;
            this._height = num5;
            double width  = this._width;
            double height = this._height;

            if (this._isBlackTheme)
            {
                this._width  = this._width + this._extraMargin * 2.0;
                this._height = this._height + this._extraMargin * 2.0;
            }
            string src    = docPreviewGraffiti2.src;
            Stream stream = (Stream)null;
            Uri    uri    = src.ConvertToUri();

            if (!uri.IsAbsoluteUri)
            {
                Stream cachedImageStream = ImageCache.Current.GetCachedImageStream(src);
                if (cachedImageStream != null)
                {
                    stream = (Stream) new MemoryStream();
                    cachedImageStream.CopyTo(stream);
                    cachedImageStream.Close();
                }
            }
            this.VirtualizableChildren.Add(!uri.IsAbsoluteUri ? (IVirtualizable) new VirtualizableImage(width, height, this.GraffitiMargin, stream, (Action <VirtualizableImage>)null, "1", false, false, Stretch.Uniform, (Brush)null, -1.0, false, false) : (IVirtualizable) new VirtualizableImage(width, height, this.GraffitiMargin, src, (Action <VirtualizableImage>)null, "1", false, false, Stretch.Uniform, (Brush)null, -1.0, false, false));
        }
예제 #9
0
        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
        private async void HandleTap(DocumentHeader docHeader)
        {
            if (docHeader.IsGif)
            {
                if (this._tapHandled)
                {
                    return;
                }
                this._tapHandled = true;
                List <PhotoOrDocument> list = (List <PhotoOrDocument>)Enumerable.ToList <PhotoOrDocument>(Enumerable.Select <Attachment, PhotoOrDocument>(Enumerable.Where <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);
                }))), (Func <Attachment, bool>)(at =>
                {
                    if (at.photo != null)
                    {
                        return(true);
                    }
                    if (at.doc != null)
                    {
                        return(at.doc.IsGif);
                    }
                    return(false);
                })), (Func <Attachment, PhotoOrDocument>)(a => new PhotoOrDocument()//todo: right?
                {
                    document = a.doc,
                    photo    = a.photo
                })));
                int index = list.IndexOf((PhotoOrDocument)Enumerable.FirstOrDefault <PhotoOrDocument>(list, (Func <PhotoOrDocument, bool>)(at =>
                {
                    if (at.document != null && at.document.owner_id == docHeader.Document.owner_id)
                    {
                        return(at.document.id == docHeader.Document.id);
                    }
                    return(false);
                })));
                InplaceGifViewerUC gifViewer = new InplaceGifViewerUC();
                await AnimationBehavior.ClearGifCacheAsync();

                Navigator.Current.NavigateToImageViewerPhotosOrGifs(index, list, false, false, null, null, false, (FrameworkElement)gifViewer, (Action <int>)(ind =>
                {
                    Doc document = list[ind].document;
                    if (document != null)
                    {
                        InplaceGifViewerViewModel gifViewerViewModel = new InplaceGifViewerViewModel(document, true, false, 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;
                    }
                }), (Action <int, bool>)((i, b) => {}), false);
                this._tapHandled = false;
            }
            else
            {
                Navigator.Current.NavigateToWebUri(docHeader.Document.url, true, false);
            }
        }
예제 #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
        public void CreateOrUpdateLayout()
        {
            List <Attachment>  attachments = this._attachments;
            DocPreviewGraffiti docPreviewGraffiti1;

            if (attachments == null)
            {
                docPreviewGraffiti1 = null;
            }
            else
            {
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: method pointer
                Func <Attachment, bool> func = new Func <Attachment, bool>((a) => { return(a.doc != null); });
                Attachment m0 = Enumerable.FirstOrDefault <Attachment>(attachments, func);
                if (m0 == null)
                {
                    docPreviewGraffiti1 = null;
                }
                else
                {
                    Doc doc = ((Attachment)m0).doc;
                    if (doc == null)
                    {
                        docPreviewGraffiti1 = null;
                    }
                    else
                    {
                        DocPreview preview = doc.preview;
                        docPreviewGraffiti1 = preview != null ? preview.graffiti :  null;
                    }
                }
            }
            DocPreviewGraffiti docPreviewGraffiti2 = docPreviewGraffiti1;

            if (docPreviewGraffiti2 == null)
            {
                return;
            }
            double num1 = 4.0 / 9.0;
            double val1 = (double)docPreviewGraffiti2.width * num1;
            double num2 = (double)docPreviewGraffiti2.height * num1;
            double num3 = val1 * 1.0 / num2;
            double num4 = Math.Min(val1, 320.0);
            double num5 = num4 / num3;

            this._width  = num4;
            this._height = num5;
            double width  = this._width;
            double height = this._height;

            if (this._isBlackTheme)
            {
                this._width  = this._width + this._extraMargin * 2.0;
                this._height = this._height + this._extraMargin * 2.0;
            }
            string src    = docPreviewGraffiti2.src;
            Stream stream = null;
            Uri    uri    = src.ConvertToUri();

            if (!uri.IsAbsoluteUri)
            {
                Stream cachedImageStream = ImageCache.Current.GetCachedImageStream(src);
                if (cachedImageStream != null)
                {
                    stream = (Stream) new MemoryStream();
                    cachedImageStream.CopyTo(stream);
                    cachedImageStream.Close();
                }
            }
            base.VirtualizableChildren.Add(!uri.IsAbsoluteUri ? (IVirtualizable) new VirtualizableImage(width, height, this.GraffitiMargin, stream, null, "1", false, false, (Stretch)2, null, -1.0, false, false) : (IVirtualizable) new VirtualizableImage(width, height, this.GraffitiMargin, src, null, "1", false, false, (Stretch)2, null, -1.0, false, false));
        }