Mercurial > silverbladetech
comparison MetroWpf/FxRates.UI/Converters/DeltaToIconConverter.cs @ 24:a8b50a087544
Stocks and FxRates working, new menu introduced. Working nicely so far
author | adminsh@apollo |
---|---|
date | Tue, 20 Mar 2012 20:18:35 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
23:399398841fd0 | 24:a8b50a087544 |
---|---|
1 using System; | |
2 using System.Windows.Data; | |
3 using System.Windows.Media.Imaging; | |
4 | |
5 namespace FxRates.UI.Converters | |
6 { | |
7 public class DeltaToIconConverter : IValueConverter | |
8 { | |
9 #region IValueConverter Members | |
10 | |
11 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | |
12 { | |
13 string uri; | |
14 BitmapImage image; | |
15 decimal delta; | |
16 string file = "UNK"; | |
17 | |
18 try | |
19 { | |
20 delta = (decimal) value; | |
21 { | |
22 if (delta > 0) | |
23 file = "UP"; | |
24 else if (delta < 0) | |
25 file = "DOWN"; | |
26 else | |
27 file = "LEVEL"; | |
28 } | |
29 } | |
30 finally | |
31 { | |
32 uri = string.Format("../Images/{0}.png", file); | |
33 image = new BitmapImage(new Uri(uri, UriKind.Relative)); | |
34 } | |
35 | |
36 return image; | |
37 } | |
38 | |
39 public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | |
40 { | |
41 throw new NotImplementedException(); | |
42 } | |
43 | |
44 #endregion | |
45 } | |
46 } |