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 instalacoes) { IEnumerable list; this.InitializeComponent(); DataGrid instalacoesView = this.InstalacoesView; IEnumerable instalacaos = from i in instalacoes where !string.IsNullOrEmpty(i.get_Gerenciador()) select i; if (instalacaos != null) { list = instalacaos.ToList(); } 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); } } }