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
|
using System;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Gestor.Application.Helpers;
using Gestor.Common.Validation;
using Gestor.Model.Common;
namespace Gestor.Application.Views.Generic;
public class BaseUserControl : UserControl
{
public virtual TipoTela Tela { get; set; }
public virtual void SomenteNumeros(object sender, TextCompositionEventArgs e)
{
Regex regex = new Regex("[^0-9]+");
((RoutedEventArgs)e).Handled = regex.IsMatch(e.Text);
}
public virtual void LetrasHabilitacao(object sender, TextCompositionEventArgs e)
{
Regex regex = new Regex("[^a-eA-E]+");
((RoutedEventArgs)e).Handled = regex.IsMatch(e.Text);
}
public virtual void Placa(object sender, TextCompositionEventArgs e)
{
Regex regex = new Regex("[^a-zA-Z0-9]+");
((RoutedEventArgs)e).Handled = regex.IsMatch(e.Text);
}
public virtual void FormatarTelefone(object sender, RoutedEventArgs e)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
TextBox val = (TextBox)sender;
if (!string.IsNullOrWhiteSpace(val.Text))
{
val.Text = ValidationHelper.FormatarTelefone(val.Text);
}
}
public virtual void FormatarDocumento(object sender, RoutedEventArgs e)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
TextBox val = (TextBox)sender;
val.Text = ValidationHelper.FormatDocument(val.Text);
}
public void DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
DatePicker val = (DatePicker)sender;
val.Text = ValidationHelper.FormatDate(val.Text);
if (string.IsNullOrEmpty(val.Text))
{
val.DisplayDate = DateTime.Today;
}
}
public void DataAtual_OnDoubleClick(object sender, RoutedEventArgs e)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
((DatePicker)sender).SelectedDate = Funcoes.GetNetworkTime().Date;
}
public void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
if ((int)e.Key == 6)
{
((DatePicker)sender).Text = Funcoes.GetNetworkTime().Date.ToString("dd/MM/yyyy");
}
}
public void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
ScrollViewer val = (ScrollViewer)sender;
val.ScrollToVerticalOffset(val.VerticalOffset - (double)e.Delta);
((RoutedEventArgs)e).Handled = true;
}
public void SomenteCaracteres(object sender, TextCompositionEventArgs e)
{
Regex regex = new Regex("[^a-zA-Z]+$");
((RoutedEventArgs)e).Handled = regex.IsMatch(e.Text);
}
public void SomenteData(object sender, TextCompositionEventArgs e)
{
Regex regex = new Regex("[^0-9/-]+");
((RoutedEventArgs)e).Handled = regex.IsMatch(e.Text);
}
}
|