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.Controls.Primitives; using System.Windows.Input; using System.Windows.Markup; using System.Windows.Threading; using Gestor.Application.Helpers; using Gestor.Application.ViewModels.Ferramentas; using Gestor.Application.Views.Generic; using Gestor.Common.Validation; using Gestor.Model.Common; using Gestor.Model.Domain.Generic; using Gestor.Model.Domain.Seguros; namespace Gestor.Application.Views.Ferramentas; public class CadastroParceiroView : BaseUserControl, IComponentConnector { [Serializable] [CompilerGenerated] private sealed class _003C_003Ec { public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); public static MouseButtonEventHandler _003C_003E9__5_0; internal void _003CContentLoad_003Eb__5_0(object sender, MouseButtonEventArgs args) { } } internal DataGrid ParceiroGrid; internal MenuItem MaisOpcoesButton; internal TextBox NomeBox; internal TextBox DocumentoPrincipalBox; internal TextBox PrimeiroPrefixo; internal TextBox PrimeiroTelefone; internal TextBox SegundoPrefixo; internal TextBox SegundoTelefone; internal TextBox TerceiroPrefixo; internal TextBox TerceiroTelefone; internal TextBox EmailBox; internal TextBox CepBox; internal TextBox EnderecoBox; internal TextBox NumeroBox; internal TextBox BairroBox; internal TextBox CidadeBox; internal TextBox EstadoBox; private bool _contentLoaded; public CadastroParceiroViewModel ViewModel { get; set; } public CadastroParceiroView(Parceiro parceiro = null) { CadastroParceiroView cadastroParceiroView = this; ((FrameworkElement)this).Tag = "CADASTRO DE PARCEIROS"; ViewModel = new CadastroParceiroViewModel(parceiro); ((FrameworkElement)this).DataContext = ViewModel; InitializeComponent(); Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; if (dispatcher != null) { dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)(Action)delegate { cadastroParceiroView.ContentLoad(parceiro); }); } } private void ContentLoad(Parceiro parceiro) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown if (parceiro == null) { ((Selector)ParceiroGrid).SelectedIndex = -1; } ((Selector)ParceiroGrid).SelectionChanged += new SelectionChangedEventHandler(ParceiroGrid_OnSelectionChanged); DataGrid parceiroGrid = ParceiroGrid; object obj = _003C_003Ec._003C_003E9__5_0; if (obj == null) { MouseButtonEventHandler val = delegate { }; _003C_003Ec._003C_003E9__5_0 = val; obj = (object)val; } ((Control)parceiroGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; } private void Incluir_OnClick(object sender, RoutedEventArgs e) { ViewModel.Incluir(); ValidarTela(); } private void Alterar_OnClick(object sender, RoutedEventArgs e) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown ViewModel.CancelParceiro = (Parceiro)((DomainBase)ViewModel.SelectedParceiro).Clone(); ViewModel.Alterar(alterar: true); ValidarTela(); ((DomainBase)ViewModel.SelectedParceiro).Initialize(); } private void Excluir_OnClick(object sender, RoutedEventArgs e) { ViewModel.Excluir(); } private async void Salvar_OnClick(object sender, RoutedEventArgs e) { ViewModel.Loading(isLoading: true); ((UIElement)NomeBox).Focus(); List> list = await ViewModel.Salvar(); ((DependencyObject)(object)this).ValidateFields(list); bool num = list == null || list.Count == 0; ViewModel.Loading(isLoading: false); if (!num) { await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); } } private void Cancelar_OnClick(object sender, RoutedEventArgs e) { ViewModel.CancelarAlteracao(); } private void AutoCompleteBoxParceiro_Populating(object sender, PopulatingEventArgs e) { e.Cancel = true; ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task> searchResult) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (searchResult.Result != null) { AutoCompleteBox val = (AutoCompleteBox)sender; val.ItemsSource = searchResult.Result; val.PopulateComplete(); } }, TaskScheduler.FromCurrentSynchronizationContext()); } private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) { ViewModel.FiltrarParceiro(""); } } private void ParceiroGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown DataGrid val = (DataGrid)sender; if (val == null || ((Selector)val).SelectedIndex >= 0) { ViewModel.SelecionarParceiro((Parceiro)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); } } private void AbrirLog_OnClick(object sender, RoutedEventArgs e) { ViewModel.AbrirLog((TipoTela)22, ((DomainBase)ViewModel.SelectedParceiro).Id); } private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e) { string text = ValidationHelper.FormatPostCode(((TextBox)sender).Text); CepBox.Text = text; if (ValidationHelper.ValidatePostCode(text)) { EnderecoBase val = await ViewModel.BuscaCep(text); if (val != null) { EnderecoBox.Text = val.Endereco; CidadeBox.Text = val.Cidade; EstadoBox.Text = val.Estado; BairroBox.Text = val.Bairro; } } } private void DocumentoPrincipalBox_LostFocus(object sender, RoutedEventArgs e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (!((TextBoxBase)(TextBox)sender).IsReadOnly) { string text = ValidationHelper.Clear(DocumentoPrincipalBox.Text); if (!string.IsNullOrEmpty(text)) { DocumentoPrincipalBox.Text = ((text.Length == 11) ? ValidationHelper.FormatDocument(text.PadLeft(11, '0').Substring(0, 11)) : ValidationHelper.FormatDocument(text.PadLeft(14, '0').Substring(0, 14))); } } } private void ValidarTela() { if (ViewModel.SelectedParceiro != null) { List> errorMessages = ViewModel.SelectedParceiro.Validate(); ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); } } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] public void InitializeComponent() { if (!_contentLoaded) { _contentLoaded = true; Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/cadastroparceiroview.xaml", UriKind.Relative); Application.LoadComponent((object)this, uri); } } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] internal Delegate _CreateDelegate(Type delegateType, string handler) { return Delegate.CreateDelegate(delegateType, this, handler); } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] [EditorBrowsable(EditorBrowsableState.Never)] void IComponentConnector.Connect(int connectionId, object target) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Expected O, but got Unknown //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Expected O, but got Unknown //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Expected O, but got Unknown //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Expected O, but got Unknown //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Expected O, but got Unknown //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Expected O, but got Unknown //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Expected O, but got Unknown //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Expected O, but got Unknown //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Expected O, but got Unknown //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Expected O, but got Unknown //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Expected O, but got Unknown //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Expected O, but got Unknown //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Expected O, but got Unknown //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Expected O, but got Unknown //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Expected O, but got Unknown //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Expected O, but got Unknown //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Expected O, but got Unknown //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Expected O, but got Unknown //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Expected O, but got Unknown //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Expected O, but got Unknown //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Expected O, but got Unknown switch (connectionId) { case 1: ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxParceiro_Populating); ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); break; case 2: ParceiroGrid = (DataGrid)target; break; case 3: ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); break; case 4: ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); break; case 5: ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); break; case 6: ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); break; case 7: ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); break; case 8: MaisOpcoesButton = (MenuItem)target; break; case 9: ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); break; case 10: NomeBox = (TextBox)target; break; case 11: DocumentoPrincipalBox = (TextBox)target; ((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_LostFocus); ((UIElement)DocumentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 12: PrimeiroPrefixo = (TextBox)target; ((UIElement)PrimeiroPrefixo).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 13: PrimeiroTelefone = (TextBox)target; ((UIElement)PrimeiroTelefone).LostFocus += new RoutedEventHandler(FormatarTelefone); ((UIElement)PrimeiroTelefone).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 14: SegundoPrefixo = (TextBox)target; ((UIElement)SegundoPrefixo).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 15: SegundoTelefone = (TextBox)target; ((UIElement)SegundoTelefone).LostFocus += new RoutedEventHandler(FormatarTelefone); ((UIElement)SegundoTelefone).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 16: TerceiroPrefixo = (TextBox)target; ((UIElement)TerceiroPrefixo).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 17: TerceiroTelefone = (TextBox)target; ((UIElement)TerceiroTelefone).LostFocus += new RoutedEventHandler(FormatarTelefone); ((UIElement)TerceiroTelefone).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 18: EmailBox = (TextBox)target; break; case 19: CepBox = (TextBox)target; ((UIElement)CepBox).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); ((UIElement)CepBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 20: EnderecoBox = (TextBox)target; break; case 21: NumeroBox = (TextBox)target; break; case 22: BairroBox = (TextBox)target; break; case 23: CidadeBox = (TextBox)target; break; case 24: EstadoBox = (TextBox)target; break; default: _contentLoaded = true; break; } } }