using System; using System.CodeDom.Compiler; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Net; using System.Runtime.InteropServices; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Forms; using System.Windows.Markup; using System.Windows.Threading; using Agger.Registro; using Gestor.Application.Helpers; using Gestor.Application.Views; using Gestor.Common.Validation; using Gestor.Infrastructure.UnitOfWork.Logic; using Gestor.Model.API; using Gestor.Model.Domain.Common; using Gestor.Model.Domain.Generic; using Gestor.Model.Domain.Seguros; using MaterialDesignThemes.Wpf; using Xceed.Wpf.AvalonDock.Controls; namespace Gestor.Application; [Serializable] public class App : Application, IStyleConnector { private bool _contentLoaded; public static Grid ProgressRing { get; set; } public static Snackbar SnackBar { get; set; } protected override void OnStartup(StartupEventArgs e) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) SetLanguage(); RegisterLogException(); Instancia.App = this; Recursos.Parametros = e.Args.ToList(); Recursos.Registrar = Recursos.Parametros.Find((string x) => x.Contains("REGISTRAR_"))?.Replace("REGISTRAR_", ""); if (!string.IsNullOrWhiteSpace(Recursos.Registrar)) { Recursos.Parametros.Remove(Recursos.Parametros.Find((string x) => x.Contains("REGISTRAR_"))); } if (Recursos.Parametros.Count > 2) { ApplicationHelper.Subkey = (new RegistryHelper(Recursos.Parametros[2]).Registrado ? Recursos.Parametros[2] : string.Empty); } Recursos.Host = Dns.GetHostEntry(Dns.GetHostName()); ApplicationHelper.Conectado = Recursos.Parametros.Contains("CONECTADO"); if (Recursos.Parametros.Contains("INICIAR")) { ((Application)this).StartupUri = new Uri("pack://application:,,,/Views/LoginWindow.xaml"); ((Application)this).OnStartup(e); } } private void RegisterLogException() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown AppDomain.CurrentDomain.UnhandledException += delegate(object s, UnhandledExceptionEventArgs exception) { Registrar((Exception)exception.ExceptionObject, (TipoErro)1000); }; ((Application)this).DispatcherUnhandledException += (DispatcherUnhandledExceptionEventHandler)delegate(object s, DispatcherUnhandledExceptionEventArgs exception) { DispatcherUnhandled(exception); }; TaskScheduler.UnobservedTaskException += delegate(object s, UnobservedTaskExceptionEventArgs exception) { Registrar(exception.Exception, (TipoErro)1000); }; } private void DispatcherUnhandled(DispatcherUnhandledExceptionEventArgs exception) { Registrar(exception.Exception, (TipoErro)1000); if (exception.Exception is COMException { ErrorCode: -2147221040 }) { exception.Handled = true; } Instancia.ExcluirCfg(); } private void Registrar(Exception e, TipoErro erro) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0056: 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_0071: 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_0078: Expected I4, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown LogError val = new LogError { IdFornecedor = ApplicationHelper.IdFornecedor }; Empresa empresa = Recursos.Empresa; val.Fornecedor = ((empresa != null) ? empresa.Nome : null); Usuario usuario = Recursos.Usuario; val.UsuarioLogado = ((usuario != null) ? usuario.Nome : null); Usuario usuario2 = Recursos.Usuario; val.IdUsuarioLogado = ((usuario2 != null) ? ((DomainBase)usuario2).Id : 0); val.Versao = ApplicationHelper.Versao.ToString(); val.Data = Funcoes.GetNetworkTime(); val.IdErro = (int)erro; val.Erro = ValidationHelper.GetDescription((Enum)(object)erro); val.HResult = e.HResult; val.InnerException = e?.InnerException?.ToString(); val.HelpLink = e.HelpLink; val.Message = e.Message; val.Source = e.Source; val.StackTrace = e.StackTrace; val.Maquina = Environment.MachineName; val.UsuarioMaquina = Environment.UserName; Erro.RegistrarErro(val); } private static void SetLanguage() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown XmlLanguage language = XmlLanguage.GetLanguage(CultureInfo.GetCultureInfo("pt-BR").IetfLanguageTag); FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), (PropertyMetadata)new FrameworkPropertyMetadata((object)language)); } public void Restart() { Application.Restart(); Application.Current.Shutdown(); } public void Close() { Application.Current.Shutdown(); } public Task ConnectionRetry() { return ((DispatcherObject)this).Dispatcher.Invoke>((Func>)async delegate { ConnectionRetryView connectionRetryView = ViewHelper.Window(); if (connectionRetryView != null) { await connectionRetryView.CloseTask.Task; return Instancia.Commited; } ConnectionRetryView connectionRetryView2 = new ConnectionRetryView(); ((Window)connectionRetryView2).ShowDialog(); return connectionRetryView2.UnitOfWOrk; }); } public void CloseToolTip_Click(object sender, RoutedEventArgs e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown ToolTip val = Extentions.FindVisualAncestor((DependencyObject)(Button)sender); if (val != null) { val.IsOpen = false; } } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] public void InitializeComponent() { if (!_contentLoaded) { _contentLoaded = true; Uri uri = new Uri("/Gestor.Application;component/app.xaml", UriKind.Relative); Application.LoadComponent((object)this, uri); } } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] [EditorBrowsable(EditorBrowsableState.Never)] void IStyleConnector.Connect(int connectionId, object target) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //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_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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown switch (connectionId) { case 1: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CloseToolTip_Click); break; case 2: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CloseToolTip_Click); break; case 3: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CloseToolTip_Click); break; case 4: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CloseToolTip_Click); break; } } [STAThread] [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] public static void Main() { App app = new App(); app.InitializeComponent(); ((Application)app).Run(); } }