summaryrefslogtreecommitdiff
path: root/Codemerx/Gestor.Application/Componentes/DialogCopiarCliente.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Codemerx/Gestor.Application/Componentes/DialogCopiarCliente.cs')
-rw-r--r--Codemerx/Gestor.Application/Componentes/DialogCopiarCliente.cs92
1 files changed, 92 insertions, 0 deletions
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<List<Cliente>> 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