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