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/DialogCopiarCliente.cs | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 Codemerx/Gestor.Application/Componentes/DialogCopiarCliente.cs (limited to 'Codemerx/Gestor.Application/Componentes/DialogCopiarCliente.cs') diff --git a/Codemerx/Gestor.Application/Componentes/DialogCopiarCliente.cs b/Codemerx/Gestor.Application/Componentes/DialogCopiarCliente.cs new file mode 100644 index 0000000..bb3abfe --- /dev/null +++ b/Codemerx/Gestor.Application/Componentes/DialogCopiarCliente.cs @@ -0,0 +1,92 @@ +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Application.ViewModels.Generic; +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.Componentes +{ + public class DialogCopiarCliente : UserControl, IComponentConnector + { + internal CopiarClienteViewModel ViewModel; + + internal AutoCompleteBox PesquisaCliente; + + internal Loading LoadingAutoComplete; + + private bool _contentLoaded; + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + public DialogCopiarCliente() + { + this.InitializeComponent(); + this.ViewModel = new CopiarClienteViewModel(); + base.DataContext = this.ViewModel; + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.get_Parameter().Trim().Length < 3) + { + return; + } + e.set_Cancel(true); + this.LoadingAutoComplete.Visibility = System.Windows.Visibility.Visible; + this.ViewModel.BuscarCliente(e.get_Parameter().Trim(), null, 2).ContinueWith((Task> searchResult) => { + this.LoadingAutoComplete.Visibility = System.Windows.Visibility.Collapsed; + if (searchResult.Result == null) + { + return; + } + AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender; + autoCompleteBox.set_ItemsSource(searchResult.Result); + autoCompleteBox.PopulateComplete(); + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + [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/dialogcopiarcliente.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + if (connectionId == 1) + { + this.PesquisaCliente = (AutoCompleteBox)target; + this.PesquisaCliente.add_Populating(new PopulatingEventHandler(this, DialogCopiarCliente.AutoCompleteBox_Populating)); + return; + } + if (connectionId != 2) + { + this._contentLoaded = true; + return; + } + this.LoadingAutoComplete = (Loading)target; + } + } +} \ No newline at end of file -- cgit v1.2.3