public static async void SetSource(this AnimatedImageSourceRenderer renderer, Uri uri) { try { await renderer.SetSourceAsync(uri); } catch { Debug.Write("AGGRESSIVE"); } }
public TLBitmapSource(TLDocument document, bool thumbnail) { _source = document; if (TLMessage.IsSticker(document)) { if (thumbnail) { SetWebPSource(null, document.Thumb, PHASE_THUMBNAIL); return; } if (TrySetWebPSource(document, PHASE_FULL) == false) { SetWebPSource(null, document.Thumb, PHASE_THUMBNAIL); SetWebPSource(document, document, document.Size, PHASE_FULL); } } else if (TLMessage.IsGif(document)) { if (thumbnail) { SetSource(null, document.Thumb, PHASE_THUMBNAIL); return; } _renderer = _animatedFactory.CreateRenderer(320, 320); Image = _renderer.ImageSource; if (TrySetAnimatedSource(document, PHASE_FULL) == false && ApplicationSettings.Current.AutoDownload[_protoService.NetworkType].HasFlag(AutoDownloadType.GIF)) { SetAnimatedSource(document, document, document.Size, PHASE_FULL); } } else if (TLMessage.IsVideo(document)) { SetSource(null, document.Thumb, PHASE_THUMBNAIL); if (ApplicationSettings.Current.AutoDownload[_protoService.NetworkType].HasFlag(AutoDownloadType.Video)) { //SetSource(photo, photo.Full, PHASE_FULL); } } else { SetSource(null, document.Thumb, PHASE_THUMBNAIL); } }