コード例 #1
0
        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);
        }
コード例 #2
0
 public ExplorerItem(ExplorerItemType argItemType)
 {
     this.itemType = argItemType;
 }