summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Views.Generic/ErrorWindow.cs
blob: 180c7752b09ae971327523c3a233df59f7ae69b8 (plain)
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
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Markup;
using Gestor.Application.Helpers;
using Gestor.Common.Validation;
using Gestor.Model.API;

namespace Gestor.Application.Views.Generic;

public class ErrorWindow : Window, IComponentConnector
{
	internal TextBlock DescricaoErro;

	internal RepeatButton ContinuarButton;

	private bool _contentLoaded;

	public ErrorWindow(TipoErro tipo, bool fecharSistema = false)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		InitializeComponent();
		HanddleErro(tipo);
		if (fecharSistema)
		{
			((UIElement)ContinuarButton).Visibility = (Visibility)2;
		}
	}

	private void HanddleErro(TipoErro tipo)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Invalid comparison between Unknown and I4
		DescricaoErro.Text = ValidationHelper.GetCategory((Enum)(object)tipo);
		if ((int)tipo != 3)
		{
			((UIElement)ContinuarButton).Visibility = (Visibility)0;
		}
		else
		{
			((UIElement)ContinuarButton).Visibility = (Visibility)2;
		}
	}

	private void ContinuarButton_OnClick(object sender, RoutedEventArgs e)
	{
		((Window)this).Close();
	}

	private void Reiniciar_OnClick(object sender, RoutedEventArgs e)
	{
		Shutdown();
	}

	private void Shutdown()
	{
		Instancia.ExcluirCfg();
		Process.Start(Application.ResourceAssembly.Location, ApplicationHelper.Conectado ? "INICIAR CONECTADO" : "INICIAR");
		Application.Current.Shutdown();
	}

	[DebuggerNonUserCode]
	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
	public void InitializeComponent()
	{
		if (!_contentLoaded)
		{
			_contentLoaded = true;
			Uri uri = new Uri("/Gestor.Application;component/views/generic/errorwindow.xaml", UriKind.Relative);
			Application.LoadComponent((object)this, uri);
		}
	}

	[DebuggerNonUserCode]
	[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
	[EditorBrowsable(EditorBrowsableState.Never)]
	void IComponentConnector.Connect(int connectionId, object target)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Expected O, but got Unknown
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Expected O, but got Unknown
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Expected O, but got Unknown
		switch (connectionId)
		{
		case 1:
			DescricaoErro = (TextBlock)target;
			break;
		case 2:
			ContinuarButton = (RepeatButton)target;
			((ButtonBase)ContinuarButton).Click += new RoutedEventHandler(ContinuarButton_OnClick);
			break;
		case 3:
			((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(Reiniciar_OnClick);
			break;
		default:
			_contentLoaded = true;
			break;
		}
	}
}