diff options
Diffstat (limited to 'Decompiler/Gestor.Application.Views.Ferramentas/ReciboView.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.Views.Ferramentas/ReciboView.cs | 334 |
1 files changed, 334 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/ReciboView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/ReciboView.cs new file mode 100644 index 0000000..268adc7 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/ReciboView.cs @@ -0,0 +1,334 @@ +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.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Ferramentas; + +public class ReciboView : BaseUserControl, IComponentConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__2_0; + + internal void _003CContentLoad_003Eb__2_0(object sender, MouseButtonEventArgs args) + { + } + } + + public ReciboViewModel ViewModel; + + internal DataGrid ReciboGrid; + + internal MenuItem MaisOpcoesButton; + + private bool _contentLoaded; + + public ReciboView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE RECIBOS"; + ViewModel = new ReciboViewModel(); + ((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)ReciboGrid).SelectedIndex = 0; + ((Selector)ReciboGrid).SelectionChanged += new SelectionChangedEventHandler(ReciboGrid_OnSelectionChanged); + DataGrid reciboGrid = ReciboGrid; + object obj = _003C_003Ec._003C_003E9__2_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__2_0 = val; + obj = (object)val; + } + ((Control)reciboGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + } + + 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) + { + ReciboGrid.ScrollIntoView(((Selector)ReciboGrid).SelectedItem); + } + else + { + 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.CancelRecibo = (Recibo)((DomainBase)ViewModel.SelectedRecibo).Clone(); + ViewModel.Alterar(alterar: true); + ValidarTela(); + ((DomainBase)ViewModel.SelectedRecibo).Initialize(); + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private void AutoCompleteBoxRecibo_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Recibo>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + 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.FiltrarRecibo(""); + } + } + + private void ReciboGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelectedRecibo = (Recibo)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null); + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)42, ((DomainBase)ViewModel.SelectedRecibo).Id); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + ValidarTela(); + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + private void Imprimir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Print(); + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Trim().Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarClienteEmpresa(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Cliente>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void ValidarTela() + { + if (ViewModel.SelectedRecibo != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedRecibo.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/ferramentas/reciboview.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_004a: 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_0060: Expected O, but got Unknown + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Expected O, but got Unknown + //IL_007a: Unknown result type (might be due to invalid IL or missing references) + //IL_0084: Expected O, but got Unknown + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //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_00b6: Unknown result type (might be due to invalid IL or missing references) + //IL_00c2: Unknown result type (might be due to invalid IL or missing references) + //IL_00cc: Expected O, but got Unknown + //IL_00ce: Unknown result type (might be due to invalid IL or missing references) + //IL_00da: Unknown result type (might be due to invalid IL or missing references) + //IL_00e4: Expected O, but got Unknown + //IL_00e6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f2: Unknown result type (might be due to invalid IL or missing references) + //IL_00fc: Expected O, but got Unknown + //IL_00ff: Unknown result type (might be due to invalid IL or missing references) + //IL_0109: Expected O, but got Unknown + //IL_010b: Unknown result type (might be due to invalid IL or missing references) + //IL_0117: Unknown result type (might be due to invalid IL or missing references) + //IL_0121: Expected O, but got Unknown + //IL_0123: Unknown result type (might be due to invalid IL or missing references) + //IL_012f: Unknown result type (might be due to invalid IL or missing references) + //IL_0139: Expected O, but got Unknown + //IL_013b: Unknown result type (might be due to invalid IL or missing references) + //IL_0147: Unknown result type (might be due to invalid IL or missing references) + //IL_0151: Expected O, but got Unknown + //IL_0152: Unknown result type (might be due to invalid IL or missing references) + //IL_015e: Unknown result type (might be due to invalid IL or missing references) + //IL_0168: Expected O, but got Unknown + //IL_0169: Unknown result type (might be due to invalid IL or missing references) + //IL_0175: Unknown result type (might be due to invalid IL or missing references) + //IL_017f: Expected O, but got Unknown + //IL_0181: Unknown result type (might be due to invalid IL or missing references) + //IL_018d: Unknown result type (might be due to invalid IL or missing references) + //IL_0197: Expected O, but got Unknown + //IL_0199: Unknown result type (might be due to invalid IL or missing references) + //IL_01a6: Unknown result type (might be due to invalid IL or missing references) + //IL_01b0: Expected O, but got Unknown + //IL_01b2: Unknown result type (might be due to invalid IL or missing references) + //IL_01be: Unknown result type (might be due to invalid IL or missing references) + //IL_01c8: Expected O, but got Unknown + //IL_01ca: Unknown result type (might be due to invalid IL or missing references) + //IL_01d7: Unknown result type (might be due to invalid IL or missing references) + //IL_01e1: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxRecibo_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + ReciboGrid = (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(Excluir_OnClick); + break; + case 8: + MaisOpcoesButton = (MenuItem)target; + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(Imprimir_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 11: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 12: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + break; + case 13: + ((UIElement)(TextBox)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(FormatarDocumento); + break; + case 14: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + break; + case 15: + ((UIElement)(TextBox)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(FormatarDocumento); + break; + default: + _contentLoaded = true; + break; + } + } +} |