using System;
using System.IO;
using System.Windows.Data;
using System.Windows.Media.Imaging;
using ReflectionStudio.Core.FileManagement;
namespace ReflectionStudio.Components.Converters
{
[ValueConversion(typeof(object), typeof(BitmapImage))]
class FileInfoToImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null) return new BitmapImage(new Uri("pack://application:,,,/Resources/Images/16x16/folders/folder_closed.png"));
DiskContent container = value as DiskContent;
if (container.IsFolder)
{
if (parameter.ToString() == "Closed")
return new BitmapImage(new Uri("pack://application:,,,/Resources/Images/16x16/folders/folder_closed.png"));
else
return new BitmapImage(new Uri("pack://application:,,,/Resources/Images/16x16/folders/folder_opened.png"));
}
return new BitmapImage(new Uri("pack://application:,,,/Resources/Images/16x16/plugin.png"));
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}
}