Statistics
| Branch: | Revision:

root / trunk / Pithos.Client.WPF / Shell / BalloonIconConverter.cs @ 28076364

History | View | Annotate | Download (1.3 kB)

1
// -----------------------------------------------------------------------
2
// <copyright file="BalloonIconConverter.cs" company="Microsoft">
3
// TODO: Update copyright text.
4
// </copyright>
5
// -----------------------------------------------------------------------
6

    
7
using System.Globalization;
8
using System.Windows.Data;
9
using System.Windows.Media.Imaging;
10
using Hardcodet.Wpf.TaskbarNotification;
11

    
12
namespace Pithos.Client.WPF.Shell
13
{
14
    using System;
15
    using System.Collections.Generic;
16
    using System.Linq;
17
    using System.Text;
18

    
19
    /// <summary>
20
    /// Convert a BalloonIcon value to an Image
21
    /// </summary>
22
    public class BalloonIconConverter:IValueConverter
23
    {
24
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
25
        {
26

    
27
            var balloon = (BalloonIcon) value;
28
            var balloonName = Enum.GetName(typeof (BalloonIcon), balloon);
29
            var imageUrl = new Uri(String.Format("/Pithos.Client.WPF;component:/{0}.png", balloonName),UriKind.Relative);
30
            var image = new BitmapImage(imageUrl);
31
            return image;
32
        }
33

    
34
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
35
        {
36
            throw new NotImplementedException();
37
        }
38
    }
39
}