Exemplo n.º 1
0
        public async Task <Size?> GetPhotoResolutionAsync()
        {
            Size?size = null;

            if (_propertiesCache.Pending)
            {
                await _propertiesCache.WaitAsync();
            }
            else if (_propertiesCache.Result == null)
            {
                await _propertiesCache.Execute(_file.Properties.GetImagePropertiesAsync().AsTask());
            }

            if (_propertiesCache.Result != null)
            {
                size = new Size(_propertiesCache.Result.Width, _propertiesCache.Result.Height);
            }

            return(size);
        }
Exemplo n.º 2
0
        public async Task <IRandomAccessStream> GetPreviewAsync()
        {
            if (_previewCache.Pending)
            {
                await _previewCache.WaitAsync();
            }
            else if (_previewCache.Result == null)
            {
                await _previewCache.Execute(GetPreviewStreamAsync());
            }

            return(_previewCache.Result.CloneStream());
        }
Exemplo n.º 3
0
        public async Task <IRandomAccessStream> GetThumbnailAsync()
        {
            if (_thumbnailCache.Pending)
            {
                await _thumbnailCache.WaitAsync();
            }
            else if (_thumbnailCache.Result == null)
            {
                await _thumbnailCache.Execute(GetThumbnailStreamAsync());
            }

            return(_thumbnailCache.Result.CloneStream());
        }
Exemplo n.º 4
0
        public async Task <IRandomAccessStream> GetFilteredThumbnailAsync()
        {
            if (_thumbnailCache.Pending)
            {
                await _thumbnailCache.WaitAsync();
            }
            else if (_thumbnailCache.Result == null || _thumbnailCache.Version != Version)
            {
                _thumbnailCache.Invalidate();

                try
                {
                    await _thumbnailCache.Execute(GetFilteredThumbnailStreamAsync(), Version);
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("GetFilteredThumbnailStreamAsync threw: " + ex.Message);
                }
            }

            return(_thumbnailCache.Result.CloneStream());
        }