Esempio n. 1
0
        private BitmapSource GetIconFreeze(FSItemInfo itemInfo, bool isSmall)
        {
            var icon = _iconService.GetIcon(itemInfo, isSmall);

            icon.Freeze();
            return(icon);
        }
Esempio n. 2
0
 public BitmapSource GetIcon(FSItemInfo itemInfo, bool isSmall = true)
 {
     lock (_lock)
     {
         var cashIcons = isSmall ? _cashSmallIcons : _cashLargeIcons;
         if (cashIcons.TryGetValue(itemInfo.IconIndex, out BitmapSource icon))
         {
             return(icon);
         }
         var newIcon = GetIconFreeze(itemInfo, isSmall);
         cashIcons.Add(itemInfo.IconIndex, newIcon);
         return(newIcon);
     }
 }
Esempio n. 3
0
        public BitmapSource GetIcon(FSItemInfo itemInfo, bool isSmall = true)
        {
            var uFlags = SHGFI.Icon | (isSmall ? SHGFI.SmallIcon : SHGFI.LargeIcon);

            if (itemInfo.FileAttributes.HasFlag(FileAttributes.Directory))
            {
                if (itemInfo.Attributes.HasFlag(SFGAO.Link))
                {
                    uFlags |= SHGFI.LinkOverlay;
                }
            }
            else
            {
                uFlags |= SHGFI.UseFileAttributes;
            }


            using (var info = new SHFInfo())
            {
                ref readonly var shfl = ref info.GetSHFileInfo(itemInfo.Path, 0, uFlags);
Esempio n. 4
0
 private Lazy <BitmapSource> GetIconLazy(FSItemInfo itemInfo, bool isSmall = true)
 => new Lazy <BitmapSource>(() => GetIcon(itemInfo, isSmall));
Esempio n. 5
0
 private BitmapSource GetIcon(FSItemInfo itemInfo, bool isSmall = true)
 => _iconServiceProxy.GetIcon(itemInfo, isSmall);
Esempio n. 6
0
 public FSItemModel(FSItemInfo itemInfo, BitmapSource smallIconLazy, Lazy <BitmapSource> largeIconLazy)
 {
     _itemInfo      = itemInfo;
     SmallIcon      = smallIconLazy;
     _largeIconLazy = largeIconLazy;
 }