From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- .../Componentes/DialogInstalacoes.cs | 125 +++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 Codemerx/Gestor.Application/Componentes/DialogInstalacoes.cs (limited to 'Codemerx/Gestor.Application/Componentes/DialogInstalacoes.cs') diff --git a/Codemerx/Gestor.Application/Componentes/DialogInstalacoes.cs b/Codemerx/Gestor.Application/Componentes/DialogInstalacoes.cs new file mode 100644 index 0000000..48ecc7e --- /dev/null +++ b/Codemerx/Gestor.Application/Componentes/DialogInstalacoes.cs @@ -0,0 +1,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 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); + } + } +} \ No newline at end of file -- cgit v1.2.3