using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Linq; using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; using System.Windows.Input; using System.Windows.Markup; using System.Windows.Threading; using Gestor.Application.Componentes; using Gestor.Application.Helpers; using Gestor.Application.ViewModels.Drawer; using Gestor.Application.Views.Generic; using Gestor.Common.Helpers; using Gestor.Common.Validation; using Gestor.Model.Common; using Gestor.Model.Domain.Ferramentas; using Gestor.Model.Domain.Generic; using MaterialDesignThemes.Wpf; using Xceed.Wpf.AvalonDock.Controls; namespace Gestor.Application.Drawers; public class AgendaDrawer : BaseUserControl, IComponentConnector, IStyleConnector { [Serializable] [CompilerGenerated] private sealed class _003C_003Ec { public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); public static MouseButtonEventHandler _003C_003E9__4_0; internal void _003CContentLoad_003Eb__4_0(object sender, MouseButtonEventArgs args) { } } internal ProgressBar ProgressBar; internal DataGrid AgendaGrid; internal MenuItem MaisOpcoesButton; internal TextBox NomeBox; internal TextBox CepBox; internal ProgressBar ProgressCep; internal TextBox EnderecoBox; internal TextBox BairroBox; internal TextBox CidadeBox; internal TextBox EstadoBox; internal TextBox ObsBox; internal ListBox TelefoneListBox; internal ListBox EmailListBox; internal Snackbar Snackbar; private bool _contentLoaded; private AgendaViewModel ViewModel { get; } public AgendaDrawer() { ViewModel = new AgendaViewModel(); ((FrameworkElement)this).DataContext = ViewModel; InitializeComponent(); Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; if (dispatcher != null) { dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); } } private void ContentLoad() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown ((Selector)AgendaGrid).SelectedIndex = 0; ((Selector)AgendaGrid).SelectionChanged += new SelectionChangedEventHandler(AgendaGrid_OnSelectionChanged); DataGrid agendaGrid = AgendaGrid; object obj = _003C_003Ec._003C_003E9__4_0; if (obj == null) { MouseButtonEventHandler val = delegate { }; _003C_003Ec._003C_003E9__4_0 = val; obj = (object)val; } ((Control)agendaGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; ViewModel.PermissaoWhatsapp = ViewModel.Restricao((TipoRestricao)32); } private void Fechar_OnClick(object sender, RoutedEventArgs e) { ViewModel.CloseDrawer(); } private void Incluir_OnClick(object sender, RoutedEventArgs e) { ViewModel.Incluir(); List> errorMessages = ViewModel.SelectedAgenda.Validate(); ((DependencyObject)(object)this).ValidateFields(errorMessages); } private void IncluirEmail_OnClick(object sender, RoutedEventArgs e) { ViewModel.IncluirEmail(); } private void ExcluirEmail_OnClick(object sender, RoutedEventArgs e) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown Button val = (Button)((sender is Button) ? sender : null); if (val != null) { ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val); AgendaEmail email = (AgendaEmail)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; ViewModel.ExcluirEmail(email); } } private void IncluirTelefone_OnClick(object sender, RoutedEventArgs e) { ViewModel.IncluirTelefone(); } private void ExcluirTelefone_OnClick(object sender, RoutedEventArgs e) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown Button val = (Button)((sender is Button) ? sender : null); if (val != null) { ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val); AgendaTelefone telefone = (AgendaTelefone)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; ViewModel.ExcluirTelefone(telefone); } } private async void Salvar_OnClick(object sender, RoutedEventArgs e) { ViewModel.Carregando = true; List> list = await ViewModel.Salvar(); ((DependencyObject)(object)this).ValidateFields(list); bool num = list == null || list.Count == 0; ViewModel.Carregando = false; if (num) { ToggleSnackBar("AGENDA SALVA COM SUCESSO"); } else { await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); } } 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.CancelAgenda = (Agenda)((DomainBase)ViewModel.SelectedAgenda).Clone(); ViewModel.Alterar(alterar: true); } private void Cancelar_OnClick(object sender, RoutedEventArgs e) { ViewModel.CancelarAlteracao(); } private async void Excluir_OnClick(object sender, RoutedEventArgs e) { if (await ViewModel.Excluir()) { ToggleSnackBar("AGENDA EXCLUÍDA COM SUCESSO"); } } 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 AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) { if (e.Parameter.Length < 3) { return; } 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.FiltrarAgenda(""); } } private async void AgendaGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { DataGrid val = (DataGrid)sender; if (val == null || ((Selector)val).SelectedIndex >= 0) { await ViewModel.SelecionaAgenda((Agenda)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); } } private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) { Snackbar.IsActive = false; } public void ToggleSnackBar(string message, bool active = true) { ((ContentControl)Snackbar.Message).Content = message; Snackbar.IsActive = active; if (active) { Task.Factory.StartNew(CloseSlackBar); } } private void CloseSlackBar() { Thread.Sleep(5000); Dispatcher dispatcher = ((DispatcherObject)ProgressBar).Dispatcher; if (dispatcher != null) { dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate { ToggleSnackBar("", active: false); }); } } private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e) { Button val = (Button)sender; ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val); TelefoneBase val3 = (TelefoneBase)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; if (!((val3.Tipo.HasValue && (int)val3.Tipo.GetValueOrDefault() == 8) ? (val3.Prefixo + val3.Numero).Clear() : ("55" + val3.Prefixo + val3.Numero.Clear())).EnviarWhatsapp()) { await ViewModel.ShowMessage("HOUVE UM PROBLEMA AO ABRIR LINK DO WHATSAPP, O LINK FOI COPIADO EM SUA MAQUINA, BASTA ABRIR O NAVEGADOR DE INTERNET E COLAR NA BARRA DE ENDEREÇOS"); } } private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown Button val = (Button)sender; ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val); TelefoneBase val3 = (TelefoneBase)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; (val3.Prefixo + ValidationHelper.OnlyNumber(val3.Numero)).CopyToClipboard(); ToggleSnackBar("COPIADO - " + val3.Prefixo + ValidationHelper.OnlyNumber(val3.Numero)); } private void CopyEmailToClipBoard_Click(object sender, RoutedEventArgs e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown Button val = (Button)sender; ListBox val2 = Extentions.FindVisualAncestor((DependencyObject)(object)val); EmailBase val3 = (EmailBase)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; val3.Email.CopyToClipboard(); ToggleSnackBar("COPIADO - " + val3.Email); } private void AbrirLog_OnClick(object sender, RoutedEventArgs e) { ViewModel.AbrirLog((TipoTela)34, ((DomainBase)ViewModel.SelectedAgenda).Id); } private void TipoComboBox_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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 ComboBox val = (ComboBox)sender; CustomIsReadOnlyControl customIsReadOnlyControl = Extentions.FindVisualAncestor((DependencyObject)(object)val); if (customIsReadOnlyControl == null) { return; } WrapPanel val2 = Extentions.FindVisualAncestor((DependencyObject)(object)customIsReadOnlyControl); ListBox val3 = Extentions.FindVisualAncestor((DependencyObject)(object)val2); ContentPresenter val4 = FindVisualChild.Find((DependencyObject)(ListBoxItem)((ItemsControl)val3).ItemContainerGenerator.ContainerFromIndex(((CollectionView)((ItemsControl)val3).Items).IndexOf(((FrameworkElement)val2).DataContext))); DataTemplate contentTemplate = val4.ContentTemplate; CustomItemValidation customItemValidation = (CustomItemValidation)((FrameworkTemplate)contentTemplate).FindName("Prefixo", (FrameworkElement)(object)val4); CustomItemValidation depObj = (CustomItemValidation)((FrameworkTemplate)contentTemplate).FindName("Telefone", (FrameworkElement)(object)val4); TextBox? obj = ((DependencyObject)(object)customItemValidation).FindChildren().FirstOrDefault(); TextBox val5 = ((DependencyObject)(object)depObj).FindChildren().FirstOrDefault(); if (obj != null && val5 != null) { if ((int)(TipoTelefone)((Selector)val).SelectedValue != 8) { ((UIElement)customItemValidation).Visibility = (Visibility)0; val5.MaxLength = 10; int length = ((val5.Text.Length >= 10) ? 10 : val5.Text.Length); val5.Text = val5.Text.Substring(0, length); } else { ((UIElement)customItemValidation).Visibility = (Visibility)2; val5.MaxLength = 20; } } } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] public void InitializeComponent() { if (!_contentLoaded) { _contentLoaded = true; Uri uri = new Uri("/Gestor.Application;component/drawers/agendadrawer.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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_0178: Unknown result type (might be due to invalid IL or missing references) //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_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Expected O, but got Unknown //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Expected O, but got Unknown //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Expected O, but got Unknown //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Expected O, but got Unknown //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Expected O, but got Unknown //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Expected O, but got Unknown //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Expected O, but got Unknown //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Expected O, but got Unknown //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Expected O, but got Unknown //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Expected O, but got Unknown //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Expected O, but got Unknown //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Expected O, but got Unknown //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Expected O, but got Unknown switch (connectionId) { case 1: ProgressBar = (ProgressBar)target; break; case 2: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick); break; case 3: ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); break; case 4: AgendaGrid = (DataGrid)target; break; case 5: ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); break; case 6: ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); break; case 7: ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); break; case 8: ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); break; case 9: ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); break; case 10: MaisOpcoesButton = (MenuItem)target; break; case 11: ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); break; case 12: NomeBox = (TextBox)target; break; case 13: CepBox = (TextBox)target; ((UIElement)CepBox).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); ((UIElement)CepBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 14: ProgressCep = (ProgressBar)target; break; case 15: EnderecoBox = (TextBox)target; break; case 16: BairroBox = (TextBox)target; break; case 17: CidadeBox = (TextBox)target; break; case 18: EstadoBox = (TextBox)target; break; case 19: ObsBox = (TextBox)target; break; case 20: ((MenuItem)target).Click += new RoutedEventHandler(IncluirTelefone_OnClick); break; case 21: TelefoneListBox = (ListBox)target; break; case 28: ((MenuItem)target).Click += new RoutedEventHandler(IncluirEmail_OnClick); break; case 29: EmailListBox = (ListBox)target; break; case 32: Snackbar = (Snackbar)target; break; case 33: ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); break; default: _contentLoaded = true; break; } } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] [EditorBrowsable(EditorBrowsableState.Never)] void IStyleConnector.Connect(int connectionId, object target) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown switch (connectionId) { case 22: ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(TipoComboBox_OnSelectionChanged); break; case 23: ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 24: ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 25: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirTelefone_OnClick); break; case 26: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CopyTelefoneToClipBoard_Click); break; case 27: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(WhatsAppMessage_Click); break; case 30: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirEmail_OnClick); break; case 31: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CopyEmailToClipBoard_Click); break; case 28: case 29: break; } } }