2014-02-19 22:50:15 +08:00
|
|
|
using System;
|
2014-07-16 18:52:00 +08:00
|
|
|
using System.Diagnostics;
|
2014-02-19 22:50:15 +08:00
|
|
|
using System.Globalization;
|
|
|
|
using System.IO;
|
2014-07-16 18:52:00 +08:00
|
|
|
using System.Windows;
|
2014-02-19 22:50:15 +08:00
|
|
|
using System.Windows.Data;
|
|
|
|
using System.Windows.Media.Imaging;
|
2014-07-14 19:03:52 +08:00
|
|
|
using Wox.Helper;
|
2014-02-19 22:50:15 +08:00
|
|
|
|
2014-05-24 16:06:09 +08:00
|
|
|
namespace Wox.Converters
|
2014-02-19 22:50:15 +08:00
|
|
|
{
|
2014-07-16 18:52:00 +08:00
|
|
|
public class ImagePathConverter : IValueConverter
|
2014-02-19 22:50:15 +08:00
|
|
|
{
|
2014-07-16 18:52:00 +08:00
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
2014-02-19 22:50:15 +08:00
|
|
|
{
|
2014-07-16 20:17:51 +08:00
|
|
|
if (value == null || value == DependencyProperty.UnsetValue)
|
2014-02-28 23:21:01 +08:00
|
|
|
{
|
2014-07-16 20:17:51 +08:00
|
|
|
return null;
|
2014-02-28 23:21:01 +08:00
|
|
|
}
|
2014-07-16 18:52:00 +08:00
|
|
|
|
2014-07-16 20:17:51 +08:00
|
|
|
return ImageLoader.Load(value.ToString());
|
2014-02-19 22:50:15 +08:00
|
|
|
}
|
|
|
|
|
2014-07-16 18:52:00 +08:00
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
2014-02-19 22:50:15 +08:00
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|