summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Views.BI/AcompanhamentoView.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Decompiler/Gestor.Application.Views.BI/AcompanhamentoView.cs')
-rw-r--r--Decompiler/Gestor.Application.Views.BI/AcompanhamentoView.cs369
1 files changed, 369 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Views.BI/AcompanhamentoView.cs b/Decompiler/Gestor.Application.Views.BI/AcompanhamentoView.cs
new file mode 100644
index 0000000..910e4d8
--- /dev/null
+++ b/Decompiler/Gestor.Application.Views.BI/AcompanhamentoView.cs
@@ -0,0 +1,369 @@
+using System;
+using System.CodeDom.Compiler;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Controls.Primitives;
+using System.Windows.Data;
+using System.Windows.Input;
+using System.Windows.Markup;
+using System.Windows.Media;
+using Gestor.Application.Helpers;
+using Gestor.Application.ViewModels;
+using Gestor.Application.Views.Generic;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Ferramentas;
+
+namespace Gestor.Application.Views.BI;
+
+public class AcompanhamentoView : BaseUserControl, IComponentConnector, IStyleConnector
+{
+ private ListBox _dragSource;
+
+ private object _data;
+
+ internal ListBox FasesListBox;
+
+ private bool _contentLoaded;
+
+ public TrilhaViewModel ViewModel { get; set; }
+
+ public AcompanhamentoView()
+ {
+ ((FrameworkElement)this).Tag = "CADASTRO DE TRILHAS";
+ ViewModel = new TrilhaViewModel();
+ ((FrameworkElement)this).DataContext = ViewModel;
+ InitializeComponent();
+ ((FrameworkElement)FasesListBox).DataContext = ViewModel;
+ }
+
+ private static object GetDataFromListBox(ItemsControl source, Point point)
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ IInputElement obj = ((UIElement)source).InputHitTest(point);
+ UIElement val = (UIElement)(object)((obj is UIElement) ? obj : null);
+ if (val != null)
+ {
+ object obj2 = DependencyProperty.UnsetValue;
+ while (obj2 == DependencyProperty.UnsetValue)
+ {
+ if (val != null)
+ {
+ obj2 = source.ItemContainerGenerator.ItemFromContainer((DependencyObject)(object)val);
+ if (obj2 == DependencyProperty.UnsetValue)
+ {
+ DependencyObject parent = VisualTreeHelper.GetParent((DependencyObject)(object)val);
+ val = (UIElement)(object)((parent is UIElement) ? parent : null);
+ }
+ if (val == source)
+ {
+ return null;
+ }
+ }
+ }
+ if (obj2 != DependencyProperty.UnsetValue)
+ {
+ return obj2;
+ }
+ }
+ return null;
+ }
+
+ private void ListBox_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ //IL_000a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0010: Expected O, but got Unknown
+ //IL_002c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_004c: Unknown result type (might be due to invalid IL or missing references)
+ if (sender is Button)
+ {
+ Button val = (Button)sender;
+ ListBox dragSource = ((DependencyObject)(object)val).FindAncestor<ListBox>().FirstOrDefault();
+ _dragSource = dragSource;
+ _data = GetDataFromListBox((ItemsControl)(object)_dragSource, ((MouseEventArgs)e).GetPosition((IInputElement)(object)val));
+ if (_data != null)
+ {
+ DragDrop.DoDragDrop((DependencyObject)(object)val, _data, (DragDropEffects)2);
+ ((RoutedEventArgs)e).Handled = true;
+ }
+ }
+ }
+
+ private void ListBox_Drop(object sender, DragEventArgs e)
+ {
+ //IL_0001: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0007: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00ad: Expected O, but got Unknown
+ //IL_0042: Unknown result type (might be due to invalid IL or missing references)
+ ListBox val = (ListBox)sender;
+ object data = e.Data.GetData(_data.GetType());
+ int index = -1;
+ for (int i = 0; i < ((CollectionView)((ItemsControl)val).Items).Count; i++)
+ {
+ DependencyObject obj = ((ItemsControl)val).ItemContainerGenerator.ContainerFromIndex(i);
+ ListBoxItem val2 = (ListBoxItem)(object)((obj is ListBoxItem) ? obj : null);
+ if (val2 != null && IsMouseOverTarget((Visual)(object)val2, e.GetPosition((IInputElement)(object)val2)))
+ {
+ index = i;
+ break;
+ }
+ }
+ object dataContext = ((FrameworkElement)_dragSource).DataContext;
+ Fase origem = (Fase)((dataContext is Fase) ? dataContext : null);
+ object dataContext2 = ((FrameworkElement)val).DataContext;
+ Fase origem2 = (Fase)((dataContext2 is Fase) ? dataContext2 : null);
+ ViewModel.Excluir(origem, (Tarefa)data);
+ ViewModel.Inserir(origem2, (Tarefa)data, index);
+ ViewModel.Update();
+ }
+
+ private static bool IsMouseOverTarget(Visual target, Point point)
+ {
+ //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)
+ //IL_0009: Unknown result type (might be due to invalid IL or missing references)
+ Rect descendantBounds = VisualTreeHelper.GetDescendantBounds(target);
+ return ((Rect)(ref descendantBounds)).Contains(point);
+ }
+
+ private void Info_OnClick(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)
+ //IL_000c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_001f: Unknown result type (might be due to invalid IL or missing references)
+ Button val = (Button)sender;
+ bool isOpen = !((ToolTip)((FrameworkElement)val).ToolTip).IsOpen;
+ ((ToolTip)((FrameworkElement)val).ToolTip).IsOpen = isOpen;
+ }
+
+ private async void AdicionarTarefa_OnClick(object sender, RoutedEventArgs e)
+ {
+ object dataContext = ((FrameworkElement)(Button)sender).DataContext;
+ Fase fase = (Fase)((dataContext is Fase) ? dataContext : null);
+ Tarefa data = new Tarefa
+ {
+ Agendamento = Funcoes.GetNetworkTime(),
+ Titulo = "NOVA TAREFA",
+ Usuario = Recursos.Usuario,
+ Trilha = ViewModel.SelectedTrilha,
+ Status = (StatusTarefa)0,
+ Fase = fase
+ };
+ ViewModel.Loading(isLoading: true);
+ while (true)
+ {
+ Tarefa val = await ViewModel.ShowTarefaDialog(data);
+ if (val == null)
+ {
+ return;
+ }
+ List<KeyValuePair<string, string>> list = await ViewModel.Salvar(val);
+ ViewModel.Loading(isLoading: false);
+ if (list == null || list.Count == 0)
+ {
+ break;
+ }
+ await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK");
+ }
+ ViewModel.ToggleSnackBar("TAREFA SALVA COM SUCESSO.");
+ ViewModel.Alterar(alterar: false);
+ }
+
+ private async void ListBox_OnPreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ ListBox val = (ListBox)sender;
+ object dataFromListBox = GetDataFromListBox((ItemsControl)(object)val, ((MouseEventArgs)e).GetPosition((IInputElement)(object)val));
+ if (dataFromListBox != null)
+ {
+ await AbrirTarefa((Tarefa)dataFromListBox);
+ }
+ }
+
+ private async Task AbrirTarefa(Tarefa data)
+ {
+ while (true)
+ {
+ Tarefa val = await ViewModel.ShowTarefaDialog(data);
+ if (val == null)
+ {
+ return;
+ }
+ List<KeyValuePair<string, string>> list = await ViewModel.Salvar(val);
+ ViewModel.Loading(isLoading: false);
+ if (list == null || list.Count == 0)
+ {
+ break;
+ }
+ await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK");
+ }
+ ViewModel.ToggleSnackBar("TAREFA SALVA COM SUCESSO.");
+ ViewModel.Alterar(alterar: false);
+ }
+
+ private async void ExcluirTarefa_OnClick(object sender, RoutedEventArgs e)
+ {
+ object dataContext = ((FrameworkElement)(Button)sender).DataContext;
+ Tarefa tarefa = (Tarefa)((dataContext is Tarefa) ? dataContext : null);
+ await ViewModel.Excluir(tarefa);
+ }
+
+ private async void EditarTarefa_OnClick(object sender, RoutedEventArgs e)
+ {
+ object dataContext = ((FrameworkElement)(Button)sender).DataContext;
+ Tarefa data = (Tarefa)((dataContext is Tarefa) ? dataContext : null);
+ await AbrirTarefa(data);
+ }
+
+ private async void TarefaConcluida_OnClick(object sender, RoutedEventArgs e)
+ {
+ object dataContext = ((FrameworkElement)(Button)sender).DataContext;
+ Tarefa val = (Tarefa)((dataContext is Tarefa) ? dataContext : null);
+ if (val != null)
+ {
+ val.Conclusao = Funcoes.GetNetworkTime();
+ val.Status = (StatusTarefa)2;
+ await ViewModel.Salvar(val);
+ await ViewModel.CarregarTrilha(ViewModel.SelectedTrilha);
+ }
+ }
+
+ private void FasesListBox_OnDragOver(object sender, DragEventArgs e)
+ {
+ //IL_0018: Unknown result type (might be due to invalid IL or missing references)
+ //IL_001d: Unknown result type (might be due to invalid IL or missing references)
+ ListBox val = (ListBox)((sender is ListBox) ? sender : null);
+ ScrollViewer val2 = AcompanhamentoView.FindVisualChild<ScrollViewer>((DependencyObject)(object)FasesListBox);
+ if (val != null)
+ {
+ Point position = e.GetPosition((IInputElement)(object)val);
+ double x = ((Point)(ref position)).X;
+ if (x < 100.0)
+ {
+ val2.ScrollToHorizontalOffset(val2.HorizontalOffset - 30.0);
+ }
+ else if (x > ((FrameworkElement)val).ActualWidth - 100.0)
+ {
+ val2.ScrollToHorizontalOffset(val2.HorizontalOffset + 30.0);
+ }
+ }
+ }
+
+ public static TChildItem FindVisualChild<TChildItem>(DependencyObject obj) where TChildItem : DependencyObject
+ {
+ for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
+ {
+ DependencyObject child = VisualTreeHelper.GetChild(obj, i);
+ TChildItem val = (TChildItem)(object)((child is TChildItem) ? child : null);
+ if (val != null)
+ {
+ return val;
+ }
+ TChildItem val2 = FindVisualChild<TChildItem>(child);
+ if (val2 != null)
+ {
+ return val2;
+ }
+ }
+ return default(TChildItem);
+ }
+
+ [DebuggerNonUserCode]
+ [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+ public void InitializeComponent()
+ {
+ if (!_contentLoaded)
+ {
+ _contentLoaded = true;
+ Uri uri = new Uri("/Gestor.Application;component/views/bi/acompanhamentoview.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_0006: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0010: Expected O, but got Unknown
+ //IL_001d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0027: Expected O, but got Unknown
+ if (connectionId == 1)
+ {
+ FasesListBox = (ListBox)target;
+ ((UIElement)FasesListBox).DragOver += new DragEventHandler(FasesListBox_OnDragOver);
+ }
+ else
+ {
+ _contentLoaded = true;
+ }
+ }
+
+ [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_006d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0079: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0083: Expected O, but got Unknown
+ //IL_0084: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0090: Unknown result type (might be due to invalid IL or missing references)
+ //IL_009a: Expected O, but got Unknown
+ //IL_009c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00a8: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00b2: Expected O, but got Unknown
+ //IL_00b4: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00c0: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00ca: Expected O, but got Unknown
+ //IL_00cc: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00d8: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00e2: Expected O, but got Unknown
+ //IL_00e4: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00f0: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00fa: Expected O, but got Unknown
+ switch (connectionId)
+ {
+ case 2:
+ ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarTarefa_OnClick);
+ break;
+ case 3:
+ ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Info_OnClick);
+ break;
+ case 4:
+ ((Control)(ListBox)target).PreviewMouseDoubleClick += new MouseButtonEventHandler(ListBox_OnPreviewMouseDoubleClick);
+ ((UIElement)(ListBox)target).MouseLeftButtonDown += new MouseButtonEventHandler(ListBox_PreviewMouseLeftButtonDown);
+ ((UIElement)(ListBox)target).Drop += new DragEventHandler(ListBox_Drop);
+ break;
+ case 5:
+ ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirTarefa_OnClick);
+ break;
+ case 6:
+ ((UIElement)(Button)target).PreviewMouseLeftButtonDown += new MouseButtonEventHandler(ListBox_PreviewMouseLeftButtonDown);
+ break;
+ case 7:
+ ((ButtonBase)(Button)target).Click += new RoutedEventHandler(EditarTarefa_OnClick);
+ break;
+ case 8:
+ ((ButtonBase)(Button)target).Click += new RoutedEventHandler(TarefaConcluida_OnClick);
+ break;
+ }
+ }
+}