summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Drawers/ExpedicaoDrawer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Decompiler/Gestor.Application.Drawers/ExpedicaoDrawer.cs')
-rw-r--r--Decompiler/Gestor.Application.Drawers/ExpedicaoDrawer.cs289
1 files changed, 289 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Drawers/ExpedicaoDrawer.cs b/Decompiler/Gestor.Application.Drawers/ExpedicaoDrawer.cs
new file mode 100644
index 0000000..831c5e0
--- /dev/null
+++ b/Decompiler/Gestor.Application.Drawers/ExpedicaoDrawer.cs
@@ -0,0 +1,289 @@
+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.ViewModels.Drawer;
+using Gestor.Application.Views.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+using MaterialDesignThemes.Wpf;
+
+namespace Gestor.Application.Drawers;
+
+public class ExpedicaoDrawer : BaseUserControl, IComponentConnector
+{
+ internal ProgressBar ProgressBar;
+
+ internal TextBox DocumentoBox;
+
+ internal TextBox DestinoBox;
+
+ internal DatePicker EnvioBox;
+
+ internal DatePicker RecebimentoBox;
+
+ internal TextBox ResponsavelBox;
+
+ internal DataGrid ExpedicaoGrid;
+
+ internal Snackbar Snackbar;
+
+ private bool _contentLoaded;
+
+ public ExpedicaoViewModel ViewModel { get; set; }
+
+ public ExpedicaoDrawer(Documento documento)
+ {
+ ViewModel = new ExpedicaoViewModel(documento);
+ ((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_003b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0045: Expected O, but got Unknown
+ //IL_0052: Unknown result type (might be due to invalid IL or missing references)
+ //IL_005c: Expected O, but got Unknown
+ ((UIElement)EnvioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus);
+ ((UIElement)EnvioBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown);
+ ((UIElement)RecebimentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus);
+ ((UIElement)RecebimentoBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown);
+ }
+
+ private void Incluir_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.Incluir();
+ }
+
+ private void Alterar_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.Alterar(alterar: true);
+ }
+
+ private async void Salvar_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.Carregando = true;
+ List<KeyValuePair<string, string>> list = await ViewModel.Salvar();
+ ((CollectionView)((ItemsControl)ExpedicaoGrid).Items).Refresh();
+ bool num = list == null || list.Count == 0;
+ ViewModel.Carregando = false;
+ if (num)
+ {
+ ToggleSnackBar("EXPEDIÇÃO SALVA COM SUCESSO");
+ }
+ else
+ {
+ await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK");
+ }
+ }
+
+ private void Cancelar_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.CancelarAlteracao();
+ }
+
+ private async void Excluir_OnClick(object sender, RoutedEventArgs e)
+ {
+ if (await ViewModel.Excluir())
+ {
+ ToggleSnackBar("EXPEDIÇÃO EXCLUÍDA COM SUCESSO");
+ }
+ }
+
+ private void Fechar_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.CloseDrawer();
+ }
+
+ 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 void Log_OnClick(object sender, RoutedEventArgs e)
+ {
+ ViewModel.AbrirLog((TipoTela)46, ((DomainBase)ViewModel.SelectedExpedicao).Id);
+ }
+
+ [DebuggerNonUserCode]
+ [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+ public void InitializeComponent()
+ {
+ if (!_contentLoaded)
+ {
+ _contentLoaded = true;
+ Uri uri = new Uri("/Gestor.Application;component/drawers/expedicaodrawer.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_005b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0067: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0071: Expected O, but got Unknown
+ //IL_0073: Unknown result type (might be due to invalid IL or missing references)
+ //IL_007f: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0089: Expected O, but got Unknown
+ //IL_008b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0097: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00a1: Expected O, but got Unknown
+ //IL_00a3: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00af: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00b9: Expected O, but got Unknown
+ //IL_00bb: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00c7: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00d1: Expected O, but got Unknown
+ //IL_00d3: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00df: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00e9: Expected O, but got Unknown
+ //IL_00eb: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00f7: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0101: Expected O, but got Unknown
+ //IL_0104: Unknown result type (might be due to invalid IL or missing references)
+ //IL_010e: Expected O, but got Unknown
+ //IL_0111: Unknown result type (might be due to invalid IL or missing references)
+ //IL_011b: Expected O, but got Unknown
+ //IL_011e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0128: Expected O, but got Unknown
+ //IL_0135: Unknown result type (might be due to invalid IL or missing references)
+ //IL_013f: Expected O, but got Unknown
+ //IL_014c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0156: Expected O, but got Unknown
+ //IL_0163: Unknown result type (might be due to invalid IL or missing references)
+ //IL_016d: 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_0187: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0191: 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_01c2: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01cc: Expected O, but got Unknown
+ //IL_01cf: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01d9: Expected O, but got Unknown
+ //IL_01dc: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01e6: Expected O, but got Unknown
+ //IL_01e8: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01f4: Unknown result type (might be due to invalid IL or missing references)
+ //IL_01fe: 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:
+ ((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:
+ ((MenuItem)target).Click += new RoutedEventHandler(Log_OnClick);
+ break;
+ case 9:
+ DocumentoBox = (TextBox)target;
+ break;
+ case 10:
+ DestinoBox = (TextBox)target;
+ break;
+ case 11:
+ EnvioBox = (DatePicker)target;
+ ((UIElement)EnvioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus);
+ ((UIElement)EnvioBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown);
+ ((Control)EnvioBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick);
+ break;
+ case 12:
+ RecebimentoBox = (DatePicker)target;
+ ((UIElement)RecebimentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus);
+ ((UIElement)RecebimentoBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown);
+ ((Control)RecebimentoBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick);
+ break;
+ case 13:
+ ResponsavelBox = (TextBox)target;
+ break;
+ case 14:
+ ExpedicaoGrid = (DataGrid)target;
+ break;
+ case 15:
+ Snackbar = (Snackbar)target;
+ break;
+ case 16:
+ ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick);
+ break;
+ default:
+ _contentLoaded = true;
+ break;
+ }
+ }
+}