summaryrefslogtreecommitdiff
path: root/Codemerx/Gestor.Application/Componentes/DialogInstalacoes.cs
blob: 48ecc7eb93d6c29ef66d6f58171d005ffd8345ad (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
using Gestor.Model.License;
using MaterialDesignThemes.Wpf;
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Markup;

namespace Gestor.Application.Componentes
{
	public class DialogInstalacoes : UserControl, IComponentConnector
	{
		internal DataGrid InstalacoesView;

		internal Button ValidarButton;

		internal Button FecharButton;

		internal MaterialDesignThemes.Wpf.Snackbar Snackbar;

		private bool _contentLoaded;

		public DialogInstalacoes(List<Instalacao> instalacoes)
		{
			IEnumerable list;
			this.InitializeComponent();
			DataGrid instalacoesView = this.InstalacoesView;
			IEnumerable<Instalacao> instalacaos = 
				from i in instalacoes
				where !string.IsNullOrEmpty(i.get_Gerenciador())
				select i;
			if (instalacaos != null)
			{
				list = instalacaos.ToList<Instalacao>();
			}
			else
			{
				list = null;
			}
			instalacoesView.ItemsSource = list;
			this.InstalacoesView.SelectedIndex = -1;
		}

		private void FecharButton_OnClick(object sender, RoutedEventArgs e)
		{
			DialogHost.CloseDialogCommand.Execute(null, this.FecharButton);
		}

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

		private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e)
		{
			this.Snackbar.get_Message().Content = "";
			this.Snackbar.set_IsActive(false);
		}

		[DebuggerNonUserCode]
		[EditorBrowsable(EditorBrowsableState.Never)]
		[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
		void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
		{
			switch (connectionId)
			{
				case 1:
				{
					this.InstalacoesView = (DataGrid)target;
					return;
				}
				case 2:
				{
					this.ValidarButton = (Button)target;
					this.ValidarButton.Click += new RoutedEventHandler(this.ValidarButton_OnClick);
					return;
				}
				case 3:
				{
					this.FecharButton = (Button)target;
					this.FecharButton.Click += new RoutedEventHandler(this.FecharButton_OnClick);
					return;
				}
				case 4:
				{
					this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target;
					return;
				}
				case 5:
				{
					((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick));
					return;
				}
			}
			this._contentLoaded = true;
		}

		private void ValidarButton_OnClick(object sender, RoutedEventArgs e)
		{
			object selectedItem = this.InstalacoesView.SelectedItem;
			if (selectedItem != null)
			{
				DialogHost.CloseDialogCommand.Execute((Instalacao)selectedItem, this.ValidarButton);
				return;
			}
			this.Snackbar.get_Message().Content = "SELECIONE A INSTALAÇÃO A SER SUBSTITUÍDA";
			this.Snackbar.set_IsActive(true);
		}
	}
}