Ejemplo n.º 1
0
        private async Task LoadItemThumbnail()
        {
            var(IconData, OverlayData, IsCustom) = await FileThumbnailHelper.LoadIconOverlayAsync(Item.ItemPath, 400);

            if (IconData != null)
            {
                Item.FileImage = await IconData.ToBitmapAsync();
            }
        }
        /// <summary>
        /// Override this and place the code to load the file preview here.
        /// You can return details that may have been obtained while loading the preview (eg. word count).
        /// This details will be displayed *before* the system file properties.
        /// If there are none, return an empty list.
        /// </summary>
        /// <returns>A list of details</returns>
        public async virtual Task <List <FileProperty> > LoadPreviewAndDetails()
        {
            var(IconData, OverlayData, IsCustom) = await FileThumbnailHelper.LoadIconOverlayAsync(Item.ItemPath, 400);

            if (IconData != null)
            {
                Item.FileImage = await IconData.ToBitmapAsync();
            }
            else
            {
                using var icon = await Item.ItemFile.GetThumbnailAsync(ThumbnailMode.SingleItem, 400);

                Item.FileImage ??= new Windows.UI.Xaml.Media.Imaging.BitmapImage();
                await Item.FileImage.SetSourceAsync(icon);
            }

            return(new List <FileProperty>());
        }