diff options
Diffstat (limited to 'Decompiler/Gestor.Application.Views.Ferramentas/ProdutoView.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.Views.Ferramentas/ProdutoView.cs | 256 |
1 files changed, 256 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Views.Ferramentas/ProdutoView.cs b/Decompiler/Gestor.Application.Views.Ferramentas/ProdutoView.cs new file mode 100644 index 0000000..c976d02 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Ferramentas/ProdutoView.cs @@ -0,0 +1,256 @@ +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.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Ferramentas; + +public class ProdutoView : 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 ProdutoViewModel ViewModel; + + internal DataGrid ProdutoGrid; + + internal MenuItem MaisOpcoesButton; + + internal ToggleButton AtivoBox; + + private bool _contentLoaded; + + public ProdutoView() + { + ((FrameworkElement)this).Tag = "CADASTRO DE PRODUTOS"; + ViewModel = new ProdutoViewModel(); + ((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)ProdutoGrid).SelectedIndex = 0; + ((Selector)ProdutoGrid).SelectionChanged += new SelectionChangedEventHandler(EstipulanteGrid_OnSelectionChanged); + DataGrid produtoGrid = ProdutoGrid; + 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)produtoGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + ValidarTela(); + } + + 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.CancelProduto = (Produto)((DomainBase)ViewModel.SelectedProduto).Clone(); + ViewModel.Alterar(alterar: true); + ValidarTela(); + ((DomainBase)ViewModel.SelectedProduto).Initialize(); + } + + private void AutoCompleteBoxProduto_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Produto>> 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.FiltrarProduto(""); + } + } + + private void EstipulanteGrid_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.SelecionaProduto((Produto)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)10, ((DomainBase)ViewModel.SelectedProduto).Id); + } + + private void ValidarTela() + { + if (ViewModel.SelectedProduto != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedProduto.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/produtoview.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_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Expected O, but got Unknown + //IL_006e: Unknown result type (might be due to invalid IL or missing references) + //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_00cf: Unknown result type (might be due to invalid IL or missing references) + //IL_00d9: Expected O, but got Unknown + //IL_00db: Unknown result type (might be due to invalid IL or missing references) + //IL_00e7: Unknown result type (might be due to invalid IL or missing references) + //IL_00f1: Expected O, but got Unknown + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_00fe: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxProduto_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + ProdutoGrid = (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: + MaisOpcoesButton = (MenuItem)target; + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 9: + AtivoBox = (ToggleButton)target; + break; + default: + _contentLoaded = true; + break; + } + } +} |