aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobToPieImageConverter.cs
blob: cc11fd4270ba63a91d1f7b76543568c58df8f612 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using Tango.BL.Entities;

namespace Tango.PPC.Jobs.Converters
{
    public class JobToPieImageConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Job job = value as Job;

            if (job != null)
            {
                String[] param = parameter.ToString().Split(',');
                double width = double.Parse(param[0]);
                double height = double.Parse(param[1]);
                return job.CreateSegmentsPie(width, height);
            }

            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}