public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { ExplorerItemType tmpItemType = (ExplorerItemType)value; string tmpPath; switch (tmpItemType) { case ExplorerItemType.Drive: tmpPath = "pack://application:,,,/ConsoleHoster;component/View/Images/diskdrive.png"; break; case ExplorerItemType.Folder: tmpPath = "pack://application:,,,/ConsoleHoster;component/View/Images/folder.png"; break; case ExplorerItemType.File: tmpPath = null; break; default: tmpPath = null; break; } BitmapImage tmpResult = null; if (tmpPath != null) { if (imageCache.ContainsKey(tmpPath)) { tmpResult = imageCache[tmpPath]; } else { tmpResult = new BitmapImage(new Uri(tmpPath)); imageCache[tmpPath] = tmpResult; } } return(tmpResult); }
public ExplorerItem(ExplorerItemType argItemType) { this.itemType = argItemType; }