blob: e1b7df07fb74a1cb2e15cbdf480346131feb7ea5 (
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
|
using Gestor.Application.Helpers;
using Gestor.Common.Validation;
using Gestor.Model.API;
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Markup;
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)
{
this.InitializeComponent();
this.HanddleErro(tipo);
if (fecharSistema)
{
this.ContinuarButton.Visibility = System.Windows.Visibility.Collapsed;
}
}
private void ContinuarButton_OnClick(object sender, RoutedEventArgs e)
{
base.Close();
}
private void HanddleErro(TipoErro tipo)
{
this.DescricaoErro.Text = ValidationHelper.GetCategory(tipo);
if (tipo != 3)
{
this.ContinuarButton.Visibility = System.Windows.Visibility.Visible;
return;
}
this.ContinuarButton.Visibility = System.Windows.Visibility.Collapsed;
}
[DebuggerNonUserCode]
[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
public void InitializeComponent()
{
if (this._contentLoaded)
{
return;
}
this._contentLoaded = true;
System.Windows.Application.LoadComponent(this, new Uri("/Gestor.Application;component/views/generic/errorwindow.xaml", UriKind.Relative));
}
private void Reiniciar_OnClick(object sender, RoutedEventArgs e)
{
this.Shutdown();
}
private void Shutdown()
{
Instancia.ExcluirCfg();
Process.Start(System.Windows.Application.ResourceAssembly.Location, (ApplicationHelper.Conectado ? "INICIAR CONECTADO" : "INICIAR"));
System.Windows.Application.Current.Shutdown();
}
[DebuggerNonUserCode]
[EditorBrowsable(EditorBrowsableState.Never)]
[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
{
switch (connectionId)
{
case 1:
{
this.DescricaoErro = (TextBlock)target;
return;
}
case 2:
{
this.ContinuarButton = (RepeatButton)target;
this.ContinuarButton.Click += new RoutedEventHandler(this.ContinuarButton_OnClick);
return;
}
case 3:
{
((RepeatButton)target).Click += new RoutedEventHandler(this.Reiniciar_OnClick);
return;
}
}
this._contentLoaded = true;
}
}
}
|