private BitmapSource GetIconFreeze(FSItemInfo itemInfo, bool isSmall) { var icon = _iconService.GetIcon(itemInfo, isSmall); icon.Freeze(); return(icon); }
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); } }
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);
private Lazy <BitmapSource> GetIconLazy(FSItemInfo itemInfo, bool isSmall = true) => new Lazy <BitmapSource>(() => GetIcon(itemInfo, isSmall));
private BitmapSource GetIcon(FSItemInfo itemInfo, bool isSmall = true) => _iconServiceProxy.GetIcon(itemInfo, isSmall);
public FSItemModel(FSItemInfo itemInfo, BitmapSource smallIconLazy, Lazy <BitmapSource> largeIconLazy) { _itemInfo = itemInfo; SmallIcon = smallIconLazy; _largeIconLazy = largeIconLazy; }