blob: 0ddd601f888ac6af1b07bcb6f9d0fd474753a65f (
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
|
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using Gestor.Common.Validation;
using Gestor.Model.Common;
namespace Gestor.Application.Helpers;
public static class DataGridExtensions
{
public static T GetVisualChild<T>(Visual parent) where T : Visual
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
T val = default(T);
int childrenCount = VisualTreeHelper.GetChildrenCount((DependencyObject)(object)parent);
for (int i = 0; i < childrenCount; i++)
{
Visual val2 = (Visual)VisualTreeHelper.GetChild((DependencyObject)(object)parent, i);
val = ((T)(object)((val2 is T) ? val2 : null)) ?? GetVisualChild<T>(val2);
if (val != null)
{
break;
}
}
return val;
}
public static void EsconderToggles(this DataGrid grid, TipoTela tela, TipoToggle toggles)
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Expected O, but got Unknown
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
try
{
foreach (object item in ((ItemsControl)grid).ItemContainerGenerator.Items)
{
grid.ScrollIntoView(item, grid.Columns[0]);
((UIElement)grid).UpdateLayout();
DataGridRow val = (DataGridRow)((ItemsControl)grid).ItemContainerGenerator.ContainerFromItem(item);
if (val == null)
{
continue;
}
grid.ScrollIntoView((object)val, grid.Columns[4]);
((UIElement)grid).UpdateLayout();
DataGridCellsPresenter visualChild = DataGridExtensions.GetVisualChild<DataGridCellsPresenter>((Visual)(object)val);
DataGridCell val2 = (DataGridCell)((ItemsControl)visualChild).ItemContainerGenerator.ContainerFromIndex(0);
if (val2 != null && ((object)val2).ToString().Contains(ValidationHelper.GetDescription((Enum)(object)tela)))
{
if (toggles.HasFlag(TipoToggle.Consultar))
{
((UIElement)(DataGridCell)((ItemsControl)visualChild).ItemContainerGenerator.ContainerFromIndex(1)).Visibility = (Visibility)1;
}
if (toggles.HasFlag(TipoToggle.Incluir))
{
((UIElement)(DataGridCell)((ItemsControl)visualChild).ItemContainerGenerator.ContainerFromIndex(2)).Visibility = (Visibility)1;
}
if (toggles.HasFlag(TipoToggle.Alterar))
{
((UIElement)(DataGridCell)((ItemsControl)visualChild).ItemContainerGenerator.ContainerFromIndex(3)).Visibility = (Visibility)1;
}
if (toggles.HasFlag(TipoToggle.Excluir))
{
((UIElement)(DataGridCell)((ItemsControl)visualChild).ItemContainerGenerator.ContainerFromIndex(4)).Visibility = (Visibility)1;
}
break;
}
}
}
catch (Exception)
{
}
}
}
|