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; } } }