summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Componentes/DialogTrilha.cs
blob: cb766eb14db5d6ab920015bec5f24f7804073fe3 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Markup;
using System.Windows.Media;
using Gestor.Application.Helpers;
using Gestor.Application.ViewModels.Generic;
using Gestor.Model.Domain.Ferramentas;

namespace Gestor.Application.Componentes;

public class DialogTrilha : UserControl, IComponentConnector, IStyleConnector
{
	private bool _contentLoaded;

	public DialogTrilhaViewModel ViewModel { get; set; }

	public DialogTrilha(DialogTrilhaViewModel viewModel)
	{
		ViewModel = viewModel;
		((FrameworkElement)this).DataContext = ViewModel;
		InitializeComponent();
	}

	private void UIElement_OnGotFocus(object sender, RoutedEventArgs e)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		DependencyObject parent = VisualTreeHelper.GetParent((DependencyObject)(UIElement)sender);
		while (!(parent is ListBoxItem))
		{
			if (parent != null)
			{
				parent = VisualTreeHelper.GetParent(parent);
			}
		}
		ListBoxItem val = (ListBoxItem)parent;
		if (!val.IsSelected)
		{
			val.IsSelected = true;
		}
	}

	private void AdicionarFase_OnClick(object sender, RoutedEventArgs e)
	{
		ViewModel.AdicionarFase();
	}

	private void ExcluirFase_OnClick(object sender, RoutedEventArgs e)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		object dataContext = ((FrameworkElement)(Button)sender).DataContext;
		Fase val = (Fase)((dataContext is Fase) ? dataContext : null);
		if (val != null)
		{
			ViewModel.ExcluirFase(val);
		}
	}

	private void UIElement_OnLostFocus(object sender, RoutedEventArgs e)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		ListBox val = ((DependencyObject)(TextBox)sender).FindAncestor<ListBox>().FirstOrDefault();
		if (val != null)
		{
			ViewModel.UpdateFase(((Selector)val).SelectedIndex);
		}
	}

	[DebuggerNonUserCode]
	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
	public void InitializeComponent()
	{
		if (!_contentLoaded)
		{
			_contentLoaded = true;
			Uri uri = new Uri("/Gestor.Application;component/componentes/dialogtrilha.xaml", UriKind.Relative);
			Application.LoadComponent((object)this, uri);
		}
	}

	[DebuggerNonUserCode]
	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
	[EditorBrowsable(EditorBrowsableState.Never)]
	void IComponentConnector.Connect(int connectionId, object target)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		if (connectionId == 1)
		{
			((MenuItem)target).Click += new RoutedEventHandler(AdicionarFase_OnClick);
		}
		else
		{
			_contentLoaded = true;
		}
	}

	[DebuggerNonUserCode]
	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
	[EditorBrowsable(EditorBrowsableState.Never)]
	void IStyleConnector.Connect(int connectionId, object target)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Expected O, but got Unknown
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Expected O, but got Unknown
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Expected O, but got Unknown
		switch (connectionId)
		{
		case 2:
			((UIElement)(TextBox)target).GotFocus += new RoutedEventHandler(UIElement_OnGotFocus);
			((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(UIElement_OnLostFocus);
			break;
		case 3:
			((UIElement)(TextBox)target).GotFocus += new RoutedEventHandler(UIElement_OnGotFocus);
			((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(UIElement_OnLostFocus);
			break;
		case 4:
			((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirFase_OnClick);
			break;
		}
	}
}