diff options
Diffstat (limited to 'Decompiler/Gestor.Application.Componentes/DialogTarefa.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.Componentes/DialogTarefa.cs | 398 |
1 files changed, 398 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Componentes/DialogTarefa.cs b/Decompiler/Gestor.Application.Componentes/DialogTarefa.cs new file mode 100644 index 0000000..a177436 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogTarefa.cs @@ -0,0 +1,398 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +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.Helpers; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Componentes; + +public class DialogTarefa : UserControl, IComponentConnector, IStyleConnector +{ + internal Button ClienteButton; + + internal Button ApoliceButton; + + internal Button SinistroButton; + + internal TextBox TituloBox; + + internal DatePicker AgendamentoBox; + + internal RadioButton AnotacoesButton; + + internal TextBox AnotacoesBox; + + internal ComboBox ResponsavelBox; + + internal DatePicker ConclusaoBox; + + internal MenuItem SalvarButton; + + internal Snackbar Snackbar; + + private bool _contentLoaded; + + private DialogTarefaViewModel ViewModel { get; } + + public DialogTarefa(Tarefa tarefa, List<TelefoneBase> telefones, bool nota = false, bool agendamento = false) + { + ViewModel = new DialogTarefaViewModel(tarefa, telefones, nota, agendamento); + ((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_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Expected I4, but got Unknown + //IL_010d: Unknown result type (might be due to invalid IL or missing references) + //IL_0117: Expected O, but got Unknown + ((UIElement)AgendamentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)AgendamentoBox).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ViewModel.PermissaoWhatsapp = ViewModel.Restricao((TipoRestricao)32); + TipoTarefa entidade = ViewModel.Tarefa.Entidade; + switch ((int)entidade) + { + default: + ((UIElement)ClienteButton).Visibility = (Visibility)2; + ((UIElement)ApoliceButton).Visibility = (Visibility)2; + break; + case 0: + ((UIElement)ClienteButton).Visibility = (Visibility)0; + ((UIElement)ApoliceButton).Visibility = (Visibility)0; + break; + case 3: + ((UIElement)ClienteButton).Visibility = (Visibility)0; + ((UIElement)ApoliceButton).Visibility = (Visibility)0; + break; + case 2: + ((UIElement)ClienteButton).Visibility = (Visibility)0; + break; + case 4: + ((UIElement)ClienteButton).Visibility = (Visibility)0; + ((UIElement)SinistroButton).Visibility = (Visibility)0; + break; + } + ((ToggleButton)AnotacoesButton).IsChecked = ViewModel.IsAnotacoes; + ((ToggleButton)AnotacoesButton).Checked += new RoutedEventHandler(Anotacoes_OnChecked); + } + + private void Anotacoes_OnChecked(object sender, RoutedEventArgs e) + { + ViewModel.IsAnotacoes = true; + } + + private void AnotacoesInternas_OnChecked(object sender, RoutedEventArgs e) + { + ViewModel.IsAnotacoes = false; + } + + private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + TelefoneBase val = (TelefoneBase)((FrameworkElement)(Button)sender).DataContext; + (val.Prefixo + val.Numero).CopyToClipboard(); + ToggleSnackBar("NÚMERO COPIADO COM SUCESSO"); + } + + private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e) + { + TelefoneBase val = (TelefoneBase)((FrameworkElement)(Button)sender).DataContext; + if (!((val.Tipo.HasValue && (int)val.Tipo.GetValueOrDefault() == 8) ? (val.Prefixo + val.Numero).Clear() : ("55" + val.Prefixo + val.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 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(3000); + Dispatcher dispatcher = ((DispatcherObject)App.ProgressRing).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate + { + ToggleSnackBar("", active: false); + }); + } + } + + private void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + if ((int)e.Key == 6) + { + ((DatePicker)sender).Text = Funcoes.GetNetworkTime().Date.ToString("dd/MM/yyyy"); + } + } + + private void DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + DatePicker val = (DatePicker)sender; + val.Text = ValidationHelper.FormatDate(val.Text); + } + + private void TimePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + TimePicker val = (TimePicker)sender; + val.TextBox.Text = ValidationHelper.FormatTime(val.TextBox.Text); + } + + private async void AcessarApolice_OnClick(object sender, RoutedEventArgs e) + { + Documento documentoSelecionado = (((int)ViewModel.Tarefa.Entidade != 3) ? (await ViewModel.CarregaApolice(ViewModel.Tarefa.IdEntidade)) : (await ViewModel.CarregaApoliceParcela(ViewModel.Tarefa.IdEntidade))); + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(documentoSelecionado, lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICES - " + ViewModel.Tarefa.Cliente)).Show(); + } + + private async void AcessarCliente_OnClick(object sender, RoutedEventArgs e) + { + ((Window)new HosterWindow((ContentControl)(object)new ClienteView(await ViewModel.CarregaCliente(ViewModel.Tarefa.IdCliente), lockInsert: true), "CADASTRO DE CLIENTE - " + ViewModel.Tarefa.Cliente)).Show(); + } + + private async void AcessarSinistro_OnClick(object sender, RoutedEventArgs e) + { + Sinistro val = await ViewModel.CarregaSinistroApolice(ViewModel.Tarefa.IdEntidade); + ((Window)new HosterWindow((ContentControl)(object)new SinistroView(val.ControleSinistro.Item, attached: false), "CADASTRO DE SINISTRO - " + val.ControleSinistro.Item.Descricao)).Show(); + } + + private void DataAtual_OnDoubleClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + ((DatePicker)sender).SelectedDate = Funcoes.GetNetworkTime().Date; + } + + private void AdicionarResponsavel_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdcionarResponsavel(); + } + + private void ExcluirResponsavel_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 + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + Usuario val3 = (Usuario)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (val3 != null) + { + ViewModel.RemoverResponsavel(val3); + } + } + } + + private void MenuItem_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Tarefa.UsuariosVinculados == null) + { + ViewModel.Tarefa.UsuariosVinculados = new List<Usuario>(); + } + DialogHost.CloseDialogCommand.Execute((object)ViewModel.Tarefa, (IInputElement)(object)SalvarButton); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogtarefa.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_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0059: Expected O, but got Unknown + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Expected O, but got Unknown + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Expected O, but got Unknown + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Expected O, but got Unknown + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Expected O, but got Unknown + //IL_00c8: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Expected O, but got Unknown + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Expected O, but got Unknown + //IL_00f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Expected O, but got Unknown + //IL_0103: Unknown result type (might be due to invalid IL or missing references) + //IL_010d: Expected O, but got Unknown + //IL_0110: Unknown result type (might be due to invalid IL or missing references) + //IL_011a: Expected O, but got Unknown + //IL_011d: Unknown result type (might be due to invalid IL or missing references) + //IL_0127: Expected O, but got Unknown + //IL_0129: Unknown result type (might be due to invalid IL or missing references) + //IL_0135: Unknown result type (might be due to invalid IL or missing references) + //IL_013f: Expected O, but got Unknown + //IL_0142: Unknown result type (might be due to invalid IL or missing references) + //IL_014c: Expected O, but got Unknown + //IL_0159: Unknown result type (might be due to invalid IL or missing references) + //IL_0163: Expected O, but got Unknown + //IL_0170: Unknown result type (might be due to invalid IL or missing references) + //IL_017a: Expected O, but got Unknown + //IL_017d: Unknown result type (might be due to invalid IL or missing references) + //IL_0187: Expected O, but got Unknown + //IL_0194: Unknown result type (might be due to invalid IL or missing references) + //IL_019e: Expected O, but got Unknown + //IL_01a1: Unknown result type (might be due to invalid IL or missing references) + //IL_01ab: Expected O, but got Unknown + //IL_01ad: Unknown result type (might be due to invalid IL or missing references) + //IL_01b9: Unknown result type (might be due to invalid IL or missing references) + //IL_01c3: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ClienteButton = (Button)target; + ((ButtonBase)ClienteButton).Click += new RoutedEventHandler(AcessarCliente_OnClick); + break; + case 2: + ApoliceButton = (Button)target; + ((ButtonBase)ApoliceButton).Click += new RoutedEventHandler(AcessarApolice_OnClick); + break; + case 3: + SinistroButton = (Button)target; + ((ButtonBase)SinistroButton).Click += new RoutedEventHandler(AcessarSinistro_OnClick); + break; + case 6: + TituloBox = (TextBox)target; + break; + case 7: + AgendamentoBox = (DatePicker)target; + ((UIElement)AgendamentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((Control)AgendamentoBox).MouseDoubleClick += new MouseButtonEventHandler(DataAtual_OnDoubleClick); + break; + case 8: + AnotacoesButton = (RadioButton)target; + break; + case 9: + AnotacoesBox = (TextBox)target; + break; + case 10: + ResponsavelBox = (ComboBox)target; + break; + case 11: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarResponsavel_OnClick); + break; + case 13: + ConclusaoBox = (DatePicker)target; + ((UIElement)ConclusaoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((Control)ConclusaoBox).MouseDoubleClick += new MouseButtonEventHandler(DataAtual_OnDoubleClick); + break; + case 14: + SalvarButton = (MenuItem)target; + SalvarButton.Click += new RoutedEventHandler(MenuItem_OnClick); + break; + case 15: + Snackbar = (Snackbar)target; + break; + case 16: + ((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_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Expected O, but got Unknown + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Expected O, but got Unknown + //IL_003f: Unknown result type (might be due to invalid IL or missing references) + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Expected O, but got Unknown + switch (connectionId) + { + case 4: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CopyTelefoneToClipBoard_Click); + break; + case 5: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(WhatsAppMessage_Click); + break; + case 12: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirResponsavel_OnClick); + break; + } + } +} |