Exemplo n.º 1
0
        private void UpdateThumbnail(MessageViewModel message, Video video, File file, bool download)
        {
            var thumbnail     = video.Thumbnail;
            var minithumbnail = video.Minithumbnail;

            if (thumbnail != null && thumbnail.Format is ThumbnailFormatJpeg)
            {
                if (file.Local.IsFileExisting())
                {
                    Texture.Source = new BitmapImage(UriEx.ToLocal(file.Local.Path));
                }
                else if (download)
                {
                    if (file.Local.CanBeDownloaded && !file.Local.IsDownloadingActive)
                    {
                        if (minithumbnail != null)
                        {
                            Texture.Source = PlaceholderHelper.GetBlurred(minithumbnail.Data);
                        }

                        message.ProtoService.DownloadFile(file.Id, 1);
                    }

                    UpdateManager.Subscribe(this, message, file, ref _thumbnailToken, UpdateThumbnail, true);
                }
            }
            else if (minithumbnail != null)
            {
                Texture.Source = PlaceholderHelper.GetBlurred(minithumbnail.Data);
            }
            else
            {
                Texture.Source = null;
            }
        }
Exemplo n.º 2
0
        private void UpdateThumbnail(MessageViewModel message, Thumbnail thumbnail, Minithumbnail minithumbnail)
        {
            if (thumbnail != null)
            {
                var file = thumbnail.File;
                if (file.Local.IsDownloadingCompleted && thumbnail.Format is ThumbnailFormatJpeg)
                {
                    //Texture.Source = new BitmapImage(UriEx.GetLocal(file.Local.Path));
                    Texture.Source = PlaceholderHelper.GetBlurred(file.Local.Path);
                }
                else if (file.Local.CanBeDownloaded && !file.Local.IsDownloadingActive)
                {
                    if (minithumbnail != null)
                    {
                        Texture.Source = PlaceholderHelper.GetBlurred(minithumbnail.Data);
                    }

                    message.ProtoService.DownloadFile(file.Id, 1);
                }
            }
            else if (minithumbnail != null)
            {
                Texture.Source = PlaceholderHelper.GetBlurred(minithumbnail.Data);
            }
        }
Exemplo n.º 3
0
 private void UpdateThumbnail(MessageViewModel message, File file)
 {
     if (file.Local.IsDownloadingCompleted)
     {
         //Texture.Source = new BitmapImage(new Uri("file:///" + file.Local.Path));
         Texture.Source = PlaceholderHelper.GetBlurred(file.Local.Path);
     }
     else if (file.Local.CanBeDownloaded && !file.Local.IsDownloadingActive)
     {
         message.ProtoService.Send(new DownloadFile(file.Id, 1));
     }
 }
Exemplo n.º 4
0
 private void UpdateThumbnail(GalleryItem item, File file)
 {
     if (file.Local.IsDownloadingCompleted)
     {
         //Texture.Source = new BitmapImage(new Uri("file:///" + file.Local.Path));
         Panel.Background = new ImageBrush {
             ImageSource = PlaceholderHelper.GetBlurred(file.Local.Path), Stretch = Stretch.UniformToFill
         };
     }
     else if (file.Local.CanBeDownloaded && !file.Local.IsDownloadingActive)
     {
         item.ProtoService.Send(new DownloadFile(file.Id, 1));
     }
 }
Exemplo n.º 5
0
 private void UpdateThumbnail(MessageViewModel message, File file)
 {
     if (file.Local.IsDownloadingCompleted)
     {
         //Background = new ImageBrush { ImageSource = new BitmapImage(new Uri("file:///" + file.Local.Path)), Stretch = Stretch.UniformToFill };
         Background = new ImageBrush {
             ImageSource = PlaceholderHelper.GetBlurred(file.Local.Path), Stretch = Stretch.UniformToFill
         };
     }
     else if (file.Local.CanBeDownloaded && !file.Local.IsDownloadingActive)
     {
         message.ProtoService.Send(new DownloadFile(file.Id, 1));
     }
 }
Exemplo n.º 6
0
 private void UpdateThumbnail(MessageViewModel message, Thumbnail thumbnail, File file)
 {
     if (file.Local.IsDownloadingCompleted)
     {
         if (thumbnail.Format is ThumbnailFormatJpeg)
         {
             //Texture.Source = new BitmapImage(new Uri("file:///" + file.Local.Path));
             Texture.Source = PlaceholderHelper.GetBlurred(file.Local.Path);
         }
         else if (!Services.SettingsService.Current.Diagnostics.SoftwareDecoderEnabled)
         {
             this.BeginOnUIThread(async() => { Texture.Source = await PlaceholderHelper.GetFirstVideoFrameAsBlurredTumbnailAsync(file.Local.Path); });
         }
     }
     else if (file.Local.CanBeDownloaded && !file.Local.IsDownloadingActive)
     {
         message.ProtoService.DownloadFile(file.Id, 1);
     }
 }
Exemplo n.º 7
0
        private void UpdateThumbnail(GalleryContent item, File file, bool download)
        {
            if (file.Local.IsFileExisting())
            {
                //Texture.Source = new BitmapImage(UriEx.GetLocal(file.Local.Path));
                Panel.Background = new ImageBrush {
                    ImageSource = PlaceholderHelper.GetBlurred(file.Local.Path), Stretch = Stretch.UniformToFill
                };
            }
            else if (download)
            {
                if (file.Local.CanBeDownloaded && !file.Local.IsDownloadingActive)
                {
                    item.ProtoService.DownloadFile(file.Id, 1);
                }

                UpdateManager.Subscribe(this, _delegate.ProtoService, file, ref _thumbnailToken, UpdateThumbnail, true);
            }
        }