Beispiel #1
0
        /// <summary>
        /// Gets the image source for the specified path
        /// </summary>
        /// <param name="path">The path to get the image source for</param>
        /// <returns>The image source</returns>
        private static ImageSource GetImageSource(FileSystemPath path)
        {
            if (IconCache.ContainsKey(path.FullPath))
            {
                return(IconCache[path.FullPath]);
            }

            // ReSharper disable once PossibleNullReferenceException
            return(Application.Current.Dispatcher.Invoke(() =>
            {
                var image = path.GetIconOrThumbnail(ShellThumbnailSize.Small).ToImageSource();

                image.Freeze();

                RL.Logger?.LogDebugSource($"The link item image source has been created for the path '{path}'");

                IconCache.Add(path.FullPath, image);

                return image;
            }));
        }