diff options
Diffstat (limited to 'Decompiler/Gestor.Application.Drawers.Relatorios/ConfiguracaoRelatorio.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.Drawers.Relatorios/ConfiguracaoRelatorio.cs | 324 |
1 files changed, 324 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Drawers.Relatorios/ConfiguracaoRelatorio.cs b/Decompiler/Gestor.Application.Drawers.Relatorios/ConfiguracaoRelatorio.cs new file mode 100644 index 0000000..afe9d1c --- /dev/null +++ b/Decompiler/Gestor.Application.Drawers.Relatorios/ConfiguracaoRelatorio.cs @@ -0,0 +1,324 @@ +using System; +using System.CodeDom.Compiler; +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.Markup; +using System.Windows.Threading; +using Gestor.Application.ViewModels.Relatorios; +using Gestor.Model.Domain.Relatorios; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Drawers.Relatorios; + +public class ConfiguracaoRelatorio : UserControl, IComponentConnector, IStyleConnector +{ + internal ProgressBar ProgressBar; + + internal RadioButton CampoButton; + + internal RadioButton TotalizacaoButton; + + internal ComboBox CampoComboBox; + + internal ComboBox TotalizacaoComboBox; + + internal DataGrid ParametrosGrid; + + internal DataGrid TotalizacaoGrid; + + internal Snackbar SnackbarArquivoDigital; + + private bool _contentLoaded; + + public RelatorioViewModel ViewModel { get; set; } + + public ConfiguracaoRelatorio(RelatorioViewModel viewModel) + { + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private async void ContentLoad() + { + ((ToggleButton)CampoButton).IsChecked = ViewModel.IsCampo; + ((ToggleButton)TotalizacaoButton).IsChecked = !ViewModel.IsCampo; + ((ToggleButton)CampoButton).Checked += new RoutedEventHandler(Campo_OnChecked); + ((ToggleButton)TotalizacaoButton).Checked += new RoutedEventHandler(Totalizacao_OnChecked); + ViewModel.IsEnabled = false; + await ViewModel.CarregarConfiguracoes(); + ViewModel.IsEnabled = true; + } + + private void Campo_OnChecked(object sender, RoutedEventArgs e) + { + ViewModel.IsCampo = true; + } + + private void Totalizacao_OnChecked(object sender, RoutedEventArgs e) + { + ViewModel.IsCampo = false; + } + + private void Fechar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CloseDrawer(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IsEnabled = false; + bool num = await ViewModel.SalvarParametros(); + ViewModel.IsEnabled = true; + if (num) + { + Toggle("CONFIGURAÇÕES SALVAS."); + } + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + SnackbarArquivoDigital.IsActive = false; + } + + public void Toggle(string message, bool active = true) + { + ((ContentControl)SnackbarArquivoDigital.Message).Content = message; + SnackbarArquivoDigital.IsActive = active; + if (active) + { + Task.Factory.StartNew(CloseSlackBar); + } + } + + private void CloseSlackBar() + { + Thread.Sleep(5000); + Dispatcher dispatcher = ((DispatcherObject)App.ProgressRing).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate + { + Toggle("", active: false); + }); + } + } + + private void AdicionarParametro_OnClick(object sender, RoutedEventArgs e) + { + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Expected O, but got Unknown + RelatorioViewModel viewModel = ViewModel; + ComboBox campoComboBox = CampoComboBox; + viewModel.AdicionarParametro((ParametrosRelatorio)((campoComboBox != null) ? ((ItemsControl)campoComboBox).Items[((Selector)CampoComboBox).SelectedIndex] : null)); + } + + private void ExcluirParametro_OnClick(object sender, RoutedEventArgs e) + { + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + DataGrid parametrosGrid = ParametrosGrid; + if (parametrosGrid == null || ((Selector)parametrosGrid).SelectedIndex >= 0) + { + RelatorioViewModel viewModel = ViewModel; + DataGrid parametrosGrid2 = ParametrosGrid; + viewModel.ExcluirParametro((ParametrosRelatorio)((parametrosGrid2 != null) ? ((ItemsControl)parametrosGrid2).Items[((Selector)ParametrosGrid).SelectedIndex] : null)); + } + } + + private void SubirParametro_OnClick(object sender, RoutedEventArgs e) + { + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + DataGrid parametrosGrid = ParametrosGrid; + if (parametrosGrid == null || ((Selector)parametrosGrid).SelectedIndex >= 0) + { + RelatorioViewModel viewModel = ViewModel; + DataGrid parametrosGrid2 = ParametrosGrid; + viewModel.SubirParametro((ParametrosRelatorio)((parametrosGrid2 != null) ? ((ItemsControl)parametrosGrid2).Items[((Selector)ParametrosGrid).SelectedIndex] : null)); + } + } + + private void DescerParametro_OnClick(object sender, RoutedEventArgs e) + { + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + DataGrid parametrosGrid = ParametrosGrid; + if (parametrosGrid == null || ((Selector)parametrosGrid).SelectedIndex >= 0) + { + RelatorioViewModel viewModel = ViewModel; + DataGrid parametrosGrid2 = ParametrosGrid; + viewModel.DescerParametro((ParametrosRelatorio)((parametrosGrid2 != null) ? ((ItemsControl)parametrosGrid2).Items[((Selector)ParametrosGrid).SelectedIndex] : null)); + } + } + + private void AdicionarTotalizacao_OnClick(object sender, RoutedEventArgs e) + { + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Expected O, but got Unknown + RelatorioViewModel viewModel = ViewModel; + ComboBox totalizacaoComboBox = TotalizacaoComboBox; + viewModel.AdicionarTotalizacao((ParametrosTotalizacao)((totalizacaoComboBox != null) ? ((ItemsControl)totalizacaoComboBox).Items[((Selector)TotalizacaoComboBox).SelectedIndex] : null)); + } + + private void ExcluirTotalizacao_OnClick(object sender, RoutedEventArgs e) + { + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + DataGrid totalizacaoGrid = TotalizacaoGrid; + if (totalizacaoGrid == null || ((Selector)totalizacaoGrid).SelectedIndex >= 0) + { + RelatorioViewModel viewModel = ViewModel; + DataGrid totalizacaoGrid2 = TotalizacaoGrid; + viewModel.ExcluirTotalizacao((ParametrosTotalizacao)((totalizacaoGrid2 != null) ? ((ItemsControl)totalizacaoGrid2).Items[((Selector)TotalizacaoGrid).SelectedIndex] : null)); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/drawers/relatorios/configuracaorelatorio.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_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Expected O, but got Unknown + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0075: Expected O, but got Unknown + //IL_0078: Unknown result type (might be due to invalid IL or missing references) + //IL_0082: Expected O, but got Unknown + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_008f: Expected O, but got Unknown + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009c: Expected O, but got Unknown + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Expected O, but got Unknown + //IL_00b7: Unknown result type (might be due to invalid IL or missing references) + //IL_00c1: Expected O, but got Unknown + //IL_00c3: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Unknown result type (might be due to invalid IL or missing references) + //IL_00d9: Expected O, but got Unknown + //IL_00dc: Unknown result type (might be due to invalid IL or missing references) + //IL_00e6: Expected O, but got Unknown + //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 + //IL_010e: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Expected O, but got Unknown + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_0126: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Fechar_OnClick); + break; + case 2: + ProgressBar = (ProgressBar)target; + break; + case 3: + CampoButton = (RadioButton)target; + break; + case 4: + TotalizacaoButton = (RadioButton)target; + break; + case 5: + CampoComboBox = (ComboBox)target; + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(AdicionarParametro_OnClick); + break; + case 7: + TotalizacaoComboBox = (ComboBox)target; + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(AdicionarTotalizacao_OnClick); + break; + case 9: + ParametrosGrid = (DataGrid)target; + break; + case 13: + TotalizacaoGrid = (DataGrid)target; + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 16: + SnackbarArquivoDigital = (Snackbar)target; + break; + case 17: + ((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_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Expected O, but got Unknown + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Expected O, but got Unknown + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Expected O, but got Unknown + switch (connectionId) + { + case 10: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(SubirParametro_OnClick); + break; + case 11: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(DescerParametro_OnClick); + break; + case 12: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirParametro_OnClick); + break; + case 14: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirTotalizacao_OnClick); + break; + case 13: + break; + } + } +} |