diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
| commit | 225aa1499e37faf9d38257caabbadc68d78b427e (patch) | |
| tree | 102bb7a40c58595348ae9d3c7076201759fe0720 /Decompiler/Gestor.Application.Drawers/AdiantamentoDrawerView.cs | |
| parent | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (diff) | |
| download | gestor-225aa1499e37faf9d38257caabbadc68d78b427e.tar.gz gestor-225aa1499e37faf9d38257caabbadc68d78b427e.zip | |
decompiler.com
Diffstat (limited to 'Decompiler/Gestor.Application.Drawers/AdiantamentoDrawerView.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.Drawers/AdiantamentoDrawerView.cs | 255 |
1 files changed, 255 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Drawers/AdiantamentoDrawerView.cs b/Decompiler/Gestor.Application.Drawers/AdiantamentoDrawerView.cs new file mode 100644 index 0000000..74ea3b8 --- /dev/null +++ b/Decompiler/Gestor.Application.Drawers/AdiantamentoDrawerView.cs @@ -0,0 +1,255 @@ +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 CurrencyTextBoxControl; +using Gestor.Application.Helpers; +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 AdiantamentoDrawerView : BaseUserControl, IComponentConnector +{ + internal ProgressBar ProgressBar; + + internal DataGrid AdiantamentoGrid; + + internal CurrencyTextBox RendaMensalBox; + + internal Snackbar Snackbar; + + private bool _contentLoaded; + + public AdiantamentoViewModel ViewModel { get; set; } + + public AdiantamentoDrawerView(Vendedor vendedor) + { + ViewModel = new AdiantamentoViewModel(vendedor); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private async void MenuList_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + ListBox val = (ListBox)sender; + if (((Selector)val).SelectedItem != null) + { + await ViewModel.CarregarAdiantamento(((Selector)val).SelectedIndex); + } + } + + private void Fechar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CloseDrawer(); + } + + 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(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ((CollectionView)((ItemsControl)AdiantamentoGrid).Items).Refresh(); + ViewModel.Carregando = false; + ViewModel.Loading(isLoading: false); + if (num) + { + ToggleSnackBar("ADIANTAMENTO SALVO COM SUCESSO"); + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + 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 Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.Excluir()) + { + ToggleSnackBar("ADIANTAMENTO EXCLUĂDO COM SUCESSO"); + } + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + Snackbar.IsActive = false; + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)36, ((DomainBase)ViewModel.SelectedAdiantamento).Id); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/drawers/adiantamentodrawerview.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_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Expected O, but got Unknown + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Expected O, but got Unknown + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_0081: Expected O, but got Unknown + //IL_0084: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: Expected O, but got Unknown + //IL_0090: Unknown result type (might be due to invalid IL or missing references) + //IL_009c: Unknown result type (might be due to invalid IL or missing references) + //IL_00a6: Expected O, but got Unknown + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Unknown result type (might be due to invalid IL or missing references) + //IL_00be: Expected O, but got Unknown + //IL_00c0: Unknown result type (might be due to invalid IL or missing references) + //IL_00cc: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Expected O, but got Unknown + //IL_00d8: Unknown result type (might be due to invalid IL or missing references) + //IL_00e4: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Expected O, but got Unknown + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_00fc: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Expected O, but got Unknown + //IL_0108: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_011e: Expected O, but got Unknown + //IL_0120: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Unknown result type (might be due to invalid IL or missing references) + //IL_0136: Expected O, but got Unknown + //IL_0137: Unknown result type (might be due to invalid IL or missing references) + //IL_0143: Unknown result type (might be due to invalid IL or missing references) + //IL_014d: Expected O, but got Unknown + //IL_014e: Unknown result type (might be due to invalid IL or missing references) + //IL_015a: Unknown result type (might be due to invalid IL or missing references) + //IL_0164: Expected O, but got Unknown + //IL_0167: Unknown result type (might be due to invalid IL or missing references) + //IL_0171: Expected O, but got Unknown + //IL_0174: Unknown result type (might be due to invalid IL or missing references) + //IL_017e: Expected O, but got Unknown + //IL_0180: Unknown result type (might be due to invalid IL or missing references) + //IL_018c: Unknown result type (might be due to invalid IL or missing references) + //IL_0196: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ProgressBar = (ProgressBar)target; + break; + case 2: + ((Selector)(ListBox)target).SelectionChanged += new SelectionChangedEventHandler(MenuList_OnSelectionChanged); + break; + case 3: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick); + break; + case 4: + AdiantamentoGrid = (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: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 11: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 12: + RendaMensalBox = (CurrencyTextBox)target; + break; + case 13: + Snackbar = (Snackbar)target; + break; + case 14: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + default: + _contentLoaded = true; + break; + } + } +} |