diff options
Diffstat (limited to 'Decompiler/Gestor.Application.Views.Financeiro/CentroDeCustoView.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.Views.Financeiro/CentroDeCustoView.cs | 237 |
1 files changed, 237 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Views.Financeiro/CentroDeCustoView.cs b/Decompiler/Gestor.Application.Views.Financeiro/CentroDeCustoView.cs new file mode 100644 index 0000000..8b21f29 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Financeiro/CentroDeCustoView.cs @@ -0,0 +1,237 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Views.Financeiro; + +public class CentroDeCustoView : UserControl, IComponentConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__5_0; + + internal void _003CContentLoad_003Eb__5_0(object sender, MouseButtonEventArgs args) + { + } + } + + private bool _seleciona = true; + + internal DataGrid CentroDeCustoGrid; + + private bool _contentLoaded; + + private CentroDeCustoViewmodel ViewModel { get; } + + public CentroDeCustoView() + { + ((FrameworkElement)this).Tag = "CENTRO DE CUSTO"; + ViewModel = new CentroDeCustoViewmodel(); + ((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)CentroDeCustoGrid).SelectedIndex = 0; + ((Selector)CentroDeCustoGrid).SelectionChanged += new SelectionChangedEventHandler(CentroDeCustoGrid_OnSelectionChanged); + DataGrid centroDeCustoGrid = CentroDeCustoGrid; + object obj = _003C_003Ec._003C_003E9__5_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__5_0 = val; + obj = (object)val; + } + ((Control)centroDeCustoGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + } + + private void CentroDeCustoGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Expected O, but got Unknown + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + if (_seleciona) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelecionaCentroDeCusto((Centro)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + 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.CancelCentro = (Centro)((DomainBase)ViewModel.SelectedCentro).Clone(); + ViewModel.Alterar(alterar: true); + ((DomainBase)ViewModel.SelectedCentro).Initialize(); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedCentro.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + } + + 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.FiltrarCentro(""); + } + } + + private void AutoCompleteBoxCentro_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Centro>> searchResult) + { + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (searchResult != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)29, ((DomainBase)ViewModel.SelectedCentro).Id); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/financeiro/centrodecustoview.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_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Expected O, but got Unknown + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Expected O, but got Unknown + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Expected O, but got Unknown + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Expected O, but got Unknown + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_0096: Unknown result type (might be due to invalid IL or missing references) + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00dc: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxCentro_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + CentroDeCustoGrid = (DataGrid)target; + 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(AbrirLog_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} |