1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
|
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<UnitOfWork> ConnectionRetry()
{
return ((DispatcherObject)this).Dispatcher.Invoke<Task<UnitOfWork>>((Func<Task<UnitOfWork>>)async delegate
{
ConnectionRetryView connectionRetryView = ViewHelper.Window<ConnectionRetryView>();
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<ToolTip>((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();
}
}
|