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 --- .../Views/Ferramentas/ProtocoloDocumentosView.cs | 209 +++++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 Codemerx/Gestor.Application/Views/Ferramentas/ProtocoloDocumentosView.cs (limited to 'Codemerx/Gestor.Application/Views/Ferramentas/ProtocoloDocumentosView.cs') diff --git a/Codemerx/Gestor.Application/Views/Ferramentas/ProtocoloDocumentosView.cs b/Codemerx/Gestor.Application/Views/Ferramentas/ProtocoloDocumentosView.cs new file mode 100644 index 0000000..06943cf --- /dev/null +++ b/Codemerx/Gestor.Application/Views/Ferramentas/ProtocoloDocumentosView.cs @@ -0,0 +1,209 @@ +using Gestor.Application.ViewModels.Ferramentas; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Seguros; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Views.Ferramentas +{ + public class ProtocoloDocumentosView : UserControl, IComponentConnector, IStyleConnector + { + private bool _contentLoaded; + + public ProtocoloDocumentosViewModel ViewModel + { + get; + set; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + public ProtocoloDocumentosView() + { + base.Tag = "PROTOCOLOS E ETIQUETAS"; + this.ViewModel = new ProtocoloDocumentosViewModel(); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + } + + private void AdicionarEtiqueta_OnClick(object sender, RoutedEventArgs e) + { + Button button = sender as Button; + if (button == null) + { + return; + } + if (button.DataContext == null) + { + return; + } + this.ViewModel.AdicionarEtiqueta((Documento)button.DataContext); + } + + private void AdicionarEtiquetaCliente_OnClick(object sender, RoutedEventArgs e) + { + MenuItem menuItem = sender as MenuItem; + if (menuItem == null) + { + return; + } + if (menuItem.DataContext == null) + { + return; + } + this.ViewModel.AdicionarEtiquetaCliente(); + } + + private void AdicionarEtiquetaCorretora_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.AdicionarEtiquetaCorretora(); + } + + private void AdicionarProtocolo_OnClick(object sender, RoutedEventArgs e) + { + Button button = sender as Button; + if (button == null) + { + return; + } + if (button.DataContext == null) + { + return; + } + this.ViewModel.AdicionarProtocolo((Documento)button.DataContext); + } + + private void AutoCompleteClienteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.get_Parameter().Length < 3) + { + return; + } + e.set_Cancel(true); + this.ViewModel.BuscarCliente(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim()), null, 2).ContinueWith((Task> searchResult) => { + if (searchResult.Result == null) + { + return; + } + AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender; + autoCompleteBox.set_ItemsSource(searchResult.Result); + autoCompleteBox.PopulateComplete(); + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void ImprimirEtiqueta_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.Imprimir(1); + } + + private void ImprimirProtocolo_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.Imprimir(0); + } + + [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/views/ferramentas/protocolodocumentosview.xaml", UriKind.Relative)); + } + + private void Remover_OnClick(object sender, RoutedEventArgs e) + { + Button button = sender as Button; + if (button == null) + { + return; + } + if (button.DataContext == null) + { + return; + } + this.ViewModel.Remover((ProtocoloEtiqueta)button.DataContext); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + switch (connectionId) + { + case 1: + { + ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, ProtocoloDocumentosView.AutoCompleteClienteBox_Populating)); + return; + } + case 2: + { + ((MenuItem)target).Click += new RoutedEventHandler(this.AdicionarEtiquetaCliente_OnClick); + return; + } + case 3: + { + ((MenuItem)target).Click += new RoutedEventHandler(this.AdicionarEtiquetaCorretora_OnClick); + return; + } + case 4: + { + ((MenuItem)target).Click += new RoutedEventHandler(this.ImprimirProtocolo_OnClick); + return; + } + case 5: + { + ((MenuItem)target).Click += new RoutedEventHandler(this.ImprimirEtiqueta_OnClick); + return; + } + } + this._contentLoaded = true; + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target) + { + switch (connectionId) + { + case 6: + { + ((Button)target).Click += new RoutedEventHandler(this.AdicionarProtocolo_OnClick); + return; + } + case 7: + { + ((Button)target).Click += new RoutedEventHandler(this.AdicionarEtiqueta_OnClick); + return; + } + case 8: + { + ((Button)target).Click += new RoutedEventHandler(this.Remover_OnClick); + return; + } + default: + { + return; + } + } + } + } +} \ No newline at end of file -- cgit v1.2.3