root / trunk / Pithos.Client.WPF / Shell / BalloonIconConverter.cs @ 28076364
History | View | Annotate | Download (1.3 kB)
1 | 28076364 | Panagiotis Kanavos | // ----------------------------------------------------------------------- |
---|---|---|---|
2 | 28076364 | Panagiotis Kanavos | // <copyright file="BalloonIconConverter.cs" company="Microsoft"> |
3 | 28076364 | Panagiotis Kanavos | // TODO: Update copyright text. |
4 | 28076364 | Panagiotis Kanavos | // </copyright> |
5 | 28076364 | Panagiotis Kanavos | // ----------------------------------------------------------------------- |
6 | 28076364 | Panagiotis Kanavos | |
7 | 28076364 | Panagiotis Kanavos | using System.Globalization; |
8 | 28076364 | Panagiotis Kanavos | using System.Windows.Data; |
9 | 28076364 | Panagiotis Kanavos | using System.Windows.Media.Imaging; |
10 | 28076364 | Panagiotis Kanavos | using Hardcodet.Wpf.TaskbarNotification; |
11 | 28076364 | Panagiotis Kanavos | |
12 | 28076364 | Panagiotis Kanavos | namespace Pithos.Client.WPF.Shell |
13 | 28076364 | Panagiotis Kanavos | { |
14 | 28076364 | Panagiotis Kanavos | using System; |
15 | 28076364 | Panagiotis Kanavos | using System.Collections.Generic; |
16 | 28076364 | Panagiotis Kanavos | using System.Linq; |
17 | 28076364 | Panagiotis Kanavos | using System.Text; |
18 | 28076364 | Panagiotis Kanavos | |
19 | 28076364 | Panagiotis Kanavos | /// <summary> |
20 | 28076364 | Panagiotis Kanavos | /// Convert a BalloonIcon value to an Image |
21 | 28076364 | Panagiotis Kanavos | /// </summary> |
22 | 28076364 | Panagiotis Kanavos | public class BalloonIconConverter:IValueConverter |
23 | 28076364 | Panagiotis Kanavos | { |
24 | 28076364 | Panagiotis Kanavos | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
25 | 28076364 | Panagiotis Kanavos | { |
26 | 28076364 | Panagiotis Kanavos | |
27 | 28076364 | Panagiotis Kanavos | var balloon = (BalloonIcon) value; |
28 | 28076364 | Panagiotis Kanavos | var balloonName = Enum.GetName(typeof (BalloonIcon), balloon); |
29 | 28076364 | Panagiotis Kanavos | var imageUrl = new Uri(String.Format("/Pithos.Client.WPF;component:/{0}.png", balloonName),UriKind.Relative); |
30 | 28076364 | Panagiotis Kanavos | var image = new BitmapImage(imageUrl); |
31 | 28076364 | Panagiotis Kanavos | return image; |
32 | 28076364 | Panagiotis Kanavos | } |
33 | 28076364 | Panagiotis Kanavos | |
34 | 28076364 | Panagiotis Kanavos | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
35 | 28076364 | Panagiotis Kanavos | { |
36 | 28076364 | Panagiotis Kanavos | throw new NotImplementedException(); |
37 | 28076364 | Panagiotis Kanavos | } |
38 | 28076364 | Panagiotis Kanavos | } |
39 | 28076364 | Panagiotis Kanavos | } |