summaryrefslogtreecommitdiff
path: root/Gestor.Common/Gestor.Common.Converters/StatusExtratoColorConverter.cs
blob: e1217f03b46715b8dfa3644be26679bf8771cc4a (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Markup;
using System.Windows.Media;
using Gestor.Model.Common;

namespace Gestor.Common.Converters;

public class StatusExtratoColorConverter : MarkupExtension, IValueConverter
{
	public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Expected I4, but got Unknown
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Expected O, but got Unknown
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Expected O, but got Unknown
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Expected O, but got Unknown
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Expected O, but got Unknown
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Expected O, but got Unknown
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Expected O, but got Unknown
		if (value == null)
		{
			return (object)new SolidColorBrush(Colors.Black);
		}
		StatusParcela val = (StatusParcela)value;
		switch ((int)val - 1)
		{
		default:
			return (object)new SolidColorBrush(Colors.Black);
		case 0:
		case 4:
		case 9:
		case 11:
		case 20:
			return (object)new SolidColorBrush(Colors.Green);
		case 1:
		case 2:
		case 5:
		case 6:
			return (object)new SolidColorBrush(Colors.Red);
		case 10:
			return (object)new SolidColorBrush((Color)Application.Current.Resources[(object)"AggerYellow100"]);
		case 7:
			return (object)new SolidColorBrush(Colors.Gray);
		}
	}

	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
	{
		return (value != null && !string.IsNullOrEmpty(value.ToString())) ? int.Parse(value.ToString()) : 0;
	}

	public override object ProvideValue(IServiceProvider serviceProvider)
	{
		return this;
	}
}