summaryrefslogtreecommitdiff
path: root/Juick/Converters/UriToImageSourceConverter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Juick/Converters/UriToImageSourceConverter.cs')
-rw-r--r--Juick/Converters/UriToImageSourceConverter.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/Juick/Converters/UriToImageSourceConverter.cs b/Juick/Converters/UriToImageSourceConverter.cs
new file mode 100644
index 0000000..4c26254
--- /dev/null
+++ b/Juick/Converters/UriToImageSourceConverter.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Ink;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using System.Windows.Data;
+using System.Globalization;
+using Kawagoe.Storage;
+
+namespace Juick.Converters
+{
+ public class UriToImageSourceConverter : IValueConverter
+ {
+ static ImageCache _cache = new PersistentImageCache("avatarsCache");
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ Uri avatarUri = (Uri)value;
+ return _cache.Get(avatarUri);
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return null;
+ }
+ }
+}