System.Drawing.Icon.ToImageSource()

Here are the examples of the csharp api class System.Drawing.Icon.ToImageSource() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

1. Example

Project: QuickLook
Source File: IconManager.cs
public static ImageSource FindIconForDir(bool large)
        {
            var icon = large ? LargeDirIcon : SmallDirIcon;
            if (icon != null)
                return icon;
            icon = IconReader.GetFolderIcon(large ? IconReader.IconSize.Large : IconReader.IconSize.Small,
                    false)
                .ToImageSource();
            if (large)
                LargeDirIcon = icon;
            else
                SmallDirIcon = icon;
            return icon;
        }

2. Example

Project: QuickLook
Source File: IconManager.cs
public static ImageSource FindIconForFilename(string fileName, bool large)
        {
            var extension = Path.GetExtension(fileName);
            if (extension == null)
                return null;
            var cache = large ? LargeIconCache : SmallIconCache;
            ImageSource icon;
            if (cache.TryGetValue(extension, out icon))
                return icon;
            icon = IconReader.GetFileIcon(fileName, large ? IconReader.IconSize.Large : IconReader.IconSize.Small,
                    false)
                .ToImageSource();
            cache.Add(extension, icon);
            return icon;
        }