using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Runtime.CompilerServices; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Input; using System.Windows.Markup; using System.Windows.Media; using System.Windows.Threading; using Gestor.Application.Actions; using Gestor.Application.ViewModels; using Gestor.Application.Views.Generic; using Gestor.Common.Validation; using Gestor.Model.Common; using Gestor.Model.Domain.Seguros; namespace Gestor.Application.Views.Menus; public class MenuItensView : BaseUserControl, IComponentConnector, IStyleConnector { [Serializable] [CompilerGenerated] private sealed class _003C_003Ec { public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); public static MouseButtonEventHandler _003C_003E9__9_0; internal void _003CContentLoad_003Eb__9_0(object sender, MouseButtonEventArgs args) { } } internal MenuItem ManterTodosButton; internal DataGrid ItemGrid; internal DataGridCheckBoxColumn CheckBoxColumn; internal DataGridTemplateColumn RenovarColumn; internal DataGridTemplateColumn CancelarColumn; internal DataGridTemplateColumn SubstituirColumn; internal DataGridTemplateColumn ReativarColumn; private bool _contentLoaded; public MenuItemViewModel ViewModel { get; set; } public MenuItensView(long ramo, ManutencaoItem manutencao = null) { ((FrameworkElement)this).Tag = "CADASTRO DE ITEM"; ViewModel = new MenuItemViewModel(ramo, manutencao); ((FrameworkElement)this).DataContext = ViewModel; InitializeComponent(); Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; if (dispatcher != null) { dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); } ((FrameworkElement)ItemGrid).DataContext = ((FrameworkElement)this).DataContext; HabilitarManutencao(manutencao); Gestor.Application.Actions.Actions.ScrollToItem = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.ScrollToItem, new Action(ScrollToIndex)); Gestor.Application.Actions.Actions.ScrollToItem = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.ScrollToItem, new Action(ScrollToIndex)); } public void ScrollToIndex() { ScrollToIndex(ItemGrid, ((Selector)ItemGrid).SelectedIndex); } public void ScrollToIndex(DataGrid grid, int index) { Visual descendantByType = GetDescendantByType((Visual)(object)grid, typeof(ScrollViewer)); Visual obj = ((descendantByType is ScrollViewer) ? descendantByType : null); int num = ((index - 5 > 0) ? (index - 5) : 0); if (obj != null) { ((ScrollViewer)obj).ScrollToVerticalOffset((double)num); } } public Visual GetDescendantByType(Visual element, Type type) { if (element == null) { return null; } if (((object)element).GetType() == type) { return element; } Visual val = null; FrameworkElement val2 = (FrameworkElement)(object)((element is FrameworkElement) ? element : null); if (val2 != null) { val2.ApplyTemplate(); } for (int i = 0; i < VisualTreeHelper.GetChildrenCount((DependencyObject)(object)element); i++) { DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(object)element, i); Visual element2 = (Visual)(object)((child is Visual) ? child : null); val = GetDescendantByType(element2, type); if (val != null) { break; } } return val; } private void HabilitarManutencao(ManutencaoItem manutencao) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected I4, but got Unknown ((DataGridColumn)RenovarColumn).Visibility = (Visibility)2; ((DataGridColumn)CancelarColumn).Visibility = (Visibility)2; ((DataGridColumn)SubstituirColumn).Visibility = (Visibility)2; ((DataGridColumn)ReativarColumn).Visibility = (Visibility)2; ((DataGridColumn)CheckBoxColumn).Visibility = (Visibility)2; ((UIElement)ManterTodosButton).Visibility = (Visibility)2; if (manutencao != null) { TipoManutencao tipo = manutencao.Tipo; switch ((int)tipo) { case 1: ((DataGridColumn)RenovarColumn).Visibility = (Visibility)0; ((DataGridColumn)CancelarColumn).Visibility = (Visibility)0; ((DataGridColumn)SubstituirColumn).Visibility = (Visibility)0; ViewModel.EndossoRenovacao = true; break; case 2: ((DataGridColumn)CancelarColumn).Visibility = (Visibility)0; ((DataGridColumn)ReativarColumn).Visibility = (Visibility)0; break; case 0: ((DataGridColumn)RenovarColumn).Visibility = (Visibility)0; ((DataGridColumn)CheckBoxColumn).Visibility = (Visibility)0; ((UIElement)ManterTodosButton).Visibility = (Visibility)0; ViewModel.EndossoRenovacao = true; break; } } } private void ContentLoad() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown ((Selector)ItemGrid).SelectionChanged += new SelectionChangedEventHandler(ItemGrid_OnSelectionChanged); DataGrid itemGrid = ItemGrid; object obj = _003C_003Ec._003C_003E9__9_0; if (obj == null) { MouseButtonEventHandler val = delegate { }; _003C_003Ec._003C_003E9__9_0 = val; obj = (object)val; } ((Control)itemGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; } private void ItemGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown DataGrid val = (DataGrid)sender; if ((val == null || ((Selector)val).SelectedIndex >= 0) && !ViewModel.AlterandoSelectedItem) { ViewModel.SelecionaItem((Item)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); } } private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) { e.Cancel = true; ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task> searchResult) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (searchResult.Result != null) { AutoCompleteBox val = (AutoCompleteBox)sender; val.ItemsSource = searchResult.Result; val.PopulateComplete(); } }, TaskScheduler.FromCurrentSynchronizationContext()); } private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) { ViewModel.FiltrarItem(""); } } private void CancelarItem_OnClick(object sender, RoutedEventArgs e) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown Button val = (Button)((sender is Button) ? sender : null); if (val != null && ((FrameworkElement)val).DataContext != null) { ViewModel.CancelarItem((Item)((FrameworkElement)val).DataContext); } } private void SubstituirItem_OnClick(object sender, RoutedEventArgs e) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown Button val = (Button)((sender is Button) ? sender : null); if (val != null && ((FrameworkElement)val).DataContext != null) { ViewModel.Substituir((Item)((FrameworkElement)val).DataContext); } } private void ManterItem_OnClick(object sender, RoutedEventArgs e) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown Button val = (Button)((sender is Button) ? sender : null); if (val != null && ((FrameworkElement)val).DataContext != null) { ViewModel.Manter((Item)((FrameworkElement)val).DataContext); } } private void ManterItens_OnClick(object sender, RoutedEventArgs e) { ViewModel.ManterItens(); } private void ReativarItem_OnClick(object sender, RoutedEventArgs e) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown Button val = (Button)((sender is Button) ? sender : null); if (val != null && ((FrameworkElement)val).DataContext != null) { ViewModel.Reativar((Item)((FrameworkElement)val).DataContext); } } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] public void InitializeComponent() { if (!_contentLoaded) { _contentLoaded = true; Uri uri = new Uri("/Gestor.Application;component/views/menus/menuitensview.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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown switch (connectionId) { case 1: ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); break; case 2: ManterTodosButton = (MenuItem)target; ManterTodosButton.Click += new RoutedEventHandler(ManterItens_OnClick); break; case 3: ItemGrid = (DataGrid)target; break; case 4: CheckBoxColumn = (DataGridCheckBoxColumn)target; break; case 5: RenovarColumn = (DataGridTemplateColumn)target; break; case 7: CancelarColumn = (DataGridTemplateColumn)target; break; case 9: SubstituirColumn = (DataGridTemplateColumn)target; break; case 11: ReativarColumn = (DataGridTemplateColumn)target; break; default: _contentLoaded = true; break; } } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] [EditorBrowsable(EditorBrowsableState.Never)] void IStyleConnector.Connect(int connectionId, object target) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown switch (connectionId) { case 6: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ManterItem_OnClick); break; case 8: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CancelarItem_OnClick); break; case 10: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(SubstituirItem_OnClick); break; case 12: ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ReativarItem_OnClick); break; case 7: case 9: case 11: break; } } }