using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Input; using System.Windows.Markup; using Gestor.Application.Componentes; using Gestor.Application.Helpers; using Gestor.Application.ViewModels.Seguros; using Gestor.Application.Views.Generic; using Gestor.Common.Helpers; using Gestor.Model.Common; using Gestor.Model.Domain.Generic; using Gestor.Model.Domain.Seguros; using Xceed.Wpf.Toolkit; namespace Gestor.Application.Views.Seguros; public class PerfilEmpresaView : BaseUserControl, IComponentConnector { public PerfilEmpresaViewModel ViewModel; private Controle _controle; internal MenuItem CancelarApoliceButton; internal TextBox TextAtividade; internal CustomIsReadOnlyControl ComboSegurancaControl; internal CheckComboBox ComboSeguranca; internal CustomIsReadOnlyControl ComboIncendioControl; internal CheckComboBox ComboIncendio; internal CheckBox ExclusivoDeposito; internal CheckBox DivisaTerrenoBaldio; internal CheckBox PatrimonioHistorio; internal CheckBox PossuiTelhado; internal CheckBox CaixasEletronicos; internal CheckBox Isopainel; internal CheckBox ConstrucaoReforma; private bool _contentLoaded; public PerfilEmpresaView(Controle controle) { _controle = controle; ((FrameworkElement)this).Tag = "CADASTRO DE PERFIL"; ViewModel = new PerfilEmpresaViewModel(controle); ((FrameworkElement)this).DataContext = ViewModel; InitializeComponent(); LoadData(); } private void LoadData() { ComboSeguranca.BindData(withSelect: false); ComboIncendio.BindData(withSelect: false); } private void Incluir_OnClick(object sender, RoutedEventArgs e) { ViewModel.EnableIncluirPerfil = false; ViewModel.Incluir(); } private void Alterar_OnClick(object sender, RoutedEventArgs e) { ViewModel.Alterar(alterar: true); } private async void Salvar_OnClick(object sender, RoutedEventArgs e) { ViewModel.Loading(isLoading: true); List> list = await ViewModel.Salvar(); ViewModel.Loading(isLoading: false); if (list != null) { await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); } } private void Cancelar_OnClick(object sender, RoutedEventArgs e) { ViewModel.CancelarAlteracao(); PerfilEmpresa selectedPerfilEmpresa = ViewModel.SelectedPerfilEmpresa; if ((selectedPerfilEmpresa != null && ((DomainBase)selectedPerfilEmpresa).Id == 0) || ViewModel.SelectedPerfilEmpresa == null) { ViewModel.EnableIncluirPerfil = true; } } private async void Excluir_OnClick(object sender, RoutedEventArgs e) { await ViewModel.Excluir(); } private void VerificaOnSelected(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_003b: Unknown result type (might be due to invalid IL or missing references) ComboBox val = (ComboBox)sender; if (((Selector)val).SelectedItem != null) { if (EnumHelper.GetDescription(((Selector)val).SelectedItem) == EnumHelper.GetDescription((AtividadeEmpresa)0)) { ViewModel.AtivaCampos = (Visibility)0; } else if ((int)ViewModel.AtivaCampos == 0) { TextAtividade.Text = ""; ViewModel.AtivaCampos = (Visibility)2; } } } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] public void InitializeComponent() { if (!_contentLoaded) { _contentLoaded = true; Uri uri = new Uri("/Gestor.Application;component/views/seguros/perfilempresaview.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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown //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 //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown switch (connectionId) { case 1: ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); break; case 2: ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); break; case 3: ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); break; case 4: CancelarApoliceButton = (MenuItem)target; CancelarApoliceButton.Click += new RoutedEventHandler(Cancelar_OnClick); break; case 5: ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); break; case 6: ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); break; case 7: ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(VerificaOnSelected); break; case 8: TextAtividade = (TextBox)target; break; case 9: ComboSegurancaControl = (CustomIsReadOnlyControl)target; break; case 10: ComboSeguranca = (CheckComboBox)target; break; case 11: ComboIncendioControl = (CustomIsReadOnlyControl)target; break; case 12: ComboIncendio = (CheckComboBox)target; break; case 13: ExclusivoDeposito = (CheckBox)target; break; case 14: DivisaTerrenoBaldio = (CheckBox)target; break; case 15: PatrimonioHistorio = (CheckBox)target; break; case 16: PossuiTelhado = (CheckBox)target; break; case 17: CaixasEletronicos = (CheckBox)target; break; case 18: Isopainel = (CheckBox)target; break; case 19: ConstrucaoReforma = (CheckBox)target; break; default: _contentLoaded = true; break; } } }