Exemplo n.º 1
0
        public Preview GetPreview(
            TdApi.Photo photo,
            PreviewQuality quality)
        {
            var types = GetTypesByQuality(quality);

            var file = photo.Sizes
                       .Where(s => Array.IndexOf(types, s.Type) >= 0)
                       .OrderBy(s => Array.IndexOf(types, s.Type))
                       .FirstOrDefault()?.Photo;

            return(new Preview
            {
                Bitmap = GetBitmap(file),
                Quality = PreviewQuality.High
            });
        }
Exemplo n.º 2
0
        public IObservable <Preview> LoadPreview(
            TdApi.Photo photo,
            PreviewQuality quality)
        {
            var types = GetTypesByQuality(quality);

            var file = photo.Sizes
                       .Where(s => Array.IndexOf(types, s.Type) >= 0)
                       .OrderBy(s => Array.IndexOf(types, s.Type))
                       .FirstOrDefault()?.Photo;

            return(LoadBitmap(file)
                   .Select(bitmap => new Preview
            {
                Bitmap = bitmap,
                Quality = quality
            }));
        }