diff options
Diffstat (limited to 'Decompiler/Gestor.Application.Views/ConnectionRetryView.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.Views/ConnectionRetryView.cs | 267 |
1 files changed, 267 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Views/ConnectionRetryView.cs b/Decompiler/Gestor.Application.Views/ConnectionRetryView.cs new file mode 100644 index 0000000..b76f86c --- /dev/null +++ b/Decompiler/Gestor.Application.Views/ConnectionRetryView.cs @@ -0,0 +1,267 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +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.Shapes; +using System.Windows.Shell; +using Gestor.Application.Helpers; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; + +namespace Gestor.Application.Views; + +public class ConnectionRetryView : Window, IComponentConnector +{ + public TaskCompletionSource<object> CloseTask = new TaskCompletionSource<object>(); + + private bool _buttonClickable; + + internal WindowChrome WindowChrome; + + internal Grid MinimizeButton; + + internal Grid CloseButton; + + internal ProgressBar ProgressRing; + + internal ItemsControl Controls; + + private bool _contentLoaded; + + public UnitOfWork UnitOfWOrk { get; set; } + + public ConnectionRetryView() + { + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Expected O, but got Unknown + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Expected O, but got Unknown + InitializeComponent(); + ((UIElement)MinimizeButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)MinimizeButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((UIElement)CloseButton).MouseEnter += new MouseEventHandler(TopControls_OnMouseEnter); + ((UIElement)CloseButton).MouseLeave += new MouseEventHandler(TopControls_OnMouseLeave); + ((Window)this).Closed += delegate + { + CloseTask.SetResult(null); + }; + } + + private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Expected O, but got Unknown + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: 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_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Expected O, but got Unknown + _buttonClickable = true; + if (((FrameworkElement)(Grid)sender).Name == "CloseButton") + { + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Color.FromRgb((byte)241, (byte)112, (byte)123)); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.Black); + } + } + else + { + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.Blue); + } + } + + private void TopControls_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (_buttonClickable) + { + ((object)this).GetType().GetMethod(((FrameworkElement)(Grid)sender).Name + "_Click")?.Invoke(this, null); + } + } + + private static void TopControls_OnMouseEnter(object sender, MouseEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: 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_0037: 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) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Expected O, but got Unknown + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Expected O, but got Unknown + ((Panel)(Grid)sender).Background = (Brush)((((FrameworkElement)(Grid)sender).Name == "CloseButton") ? new SolidColorBrush(Color.FromRgb((byte)232, (byte)17, (byte)35)) : new SolidColorBrush(Colors.Blue)); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + private void TopControls_OnMouseLeave(object sender, MouseEventArgs e) + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Expected O, but got Unknown + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0041: Expected O, but got Unknown + _buttonClickable = false; + ((Panel)(Grid)sender).Background = (Brush)new SolidColorBrush(Colors.Transparent); + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(Grid)sender, 0); + Path val = (Path)(object)((child is Path) ? child : null); + if (val != null) + { + ((Shape)val).Stroke = (Brush)new SolidColorBrush(Colors.White); + } + } + + public void MinimizeButton_Click() + { + ((Window)this).WindowState = (WindowState)1; + } + + public void CloseButton_Click() + { + ((Window)this).Close(); + } + + private void Loading(bool isLoading) + { + ((UIElement)Controls).Visibility = (Visibility)(isLoading ? 2 : 0); + ((UIElement)ProgressRing).Visibility = (Visibility)((!isLoading) ? 2 : 0); + ((UIElement)this).IsEnabled = !isLoading; + } + + private async void btnRetry_Click(object sender, RoutedEventArgs e) + { + Loading(isLoading: true); + UnitOfWork val = await Task.Run((Func<UnitOfWork>)delegate + { + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + try + { + Instancia.Conexao = Instancia.Conexao ?? Connection.GetConnection(); + return new UnitOfWork(Instancia.Conexao, true); + } + catch (Exception) + { + return (UnitOfWork)null; + } + }); + Loading(isLoading: false); + if (val != null && ((GenericUnitOfWork)val).HasSession) + { + UnitOfWOrk = val; + ((Window)this).Close(); + } + } + + private void btnRestart_OnClick(object sender, RoutedEventArgs e) + { + Instancia.App.Restart(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/connectionretryview.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_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Expected O, but got Unknown + //IL_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0059: Expected O, but got Unknown + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Expected O, but got Unknown + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Expected O, but got Unknown + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Expected O, but got Unknown + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Expected O, but got Unknown + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00dd: Expected O, but got Unknown + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00eb: Unknown result type (might be due to invalid IL or missing references) + //IL_00f5: Expected O, but got Unknown + switch (connectionId) + { + case 1: + WindowChrome = (WindowChrome)target; + break; + case 2: + MinimizeButton = (Grid)target; + ((UIElement)MinimizeButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)MinimizeButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 3: + CloseButton = (Grid)target; + ((UIElement)CloseButton).MouseLeftButtonDown += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonDown); + ((UIElement)CloseButton).MouseLeftButtonUp += new MouseButtonEventHandler(TopControls_OnMouseLeftButtonUp); + break; + case 4: + ProgressRing = (ProgressBar)target; + break; + case 5: + Controls = (ItemsControl)target; + break; + case 6: + ((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(btnRetry_Click); + break; + case 7: + ((ButtonBase)(RepeatButton)target).Click += new RoutedEventHandler(btnRestart_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} |