summaryrefslogtreecommitdiff
path: root/Gestor.Application/Views/Financeiro/InfoExtratoView.cs
blob: a666da907475500c5fedd0c8b3ca1d48a04d72a2 (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
using Gestor.Application.ViewModels.Financeiro;
using Gestor.Application.ViewModels.Generic;
using Gestor.Application.Views.Generic;
using Gestor.Model.Domain.Financeiro;
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Shapes;

namespace Gestor.Application.Views.Financeiro
{
	public class InfoExtratoView : BaseUserControl, IComponentConnector
	{
		private bool _buttonClickable;

		private bool _contentLoaded;

		public InfoExtratoViewModel ViewModel
		{
			get;
			set;
		}

		[DebuggerNonUserCode]
		[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
		internal Delegate _CreateDelegate(Type delegateType, string handler)
		{
			return Delegate.CreateDelegate(delegateType, this, handler);
		}

		public InfoExtratoView(Saldo saldo, bool telaBancos = false)
		{
			this.ViewModel = new InfoExtratoViewModel(telaBancos);
			base.DataContext = this.ViewModel;
			this.ViewModel.SelectedSaldo = saldo;
			this.InitializeComponent();
		}

		[DebuggerNonUserCode]
		[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			System.Windows.Application.LoadComponent(this, new Uri("/Gestor.Application;component/views/financeiro/infoextratoview.xaml", UriKind.Relative));
		}

		private async void Salvar_OnClick(object sender, RoutedEventArgs e)
		{
			bool flag;
			this.ViewModel.Loading(true);
			List<KeyValuePair<string, string>> keyValuePairs = await this.ViewModel.Salvar();
			flag = (keyValuePairs == null ? true : keyValuePairs.Count == 0);
			this.ViewModel.Loading(false);
			if (!flag)
			{
				await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", "");
			}
		}

		[DebuggerNonUserCode]
		[EditorBrowsable(EditorBrowsableState.Never)]
		[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
		void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
		{
			if (connectionId != 1)
			{
				this._contentLoaded = true;
				return;
			}
			((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick);
		}

		private static void TopControls_OnMouseEnter(object sender, MouseEventArgs e)
		{
			((Grid)sender).Background = (((Grid)sender).Name == "CloseButton" ? new SolidColorBrush(Colors.IndianRed) : new SolidColorBrush(Colors.Gray));
			Path child = VisualTreeHelper.GetChild((Grid)sender, 0) as Path;
			if (child != null)
			{
				child.Stroke = new SolidColorBrush(Colors.White);
			}
		}

		private void TopControls_OnMouseLeave(object sender, MouseEventArgs e)
		{
			this._buttonClickable = false;
			((Grid)sender).Background = new SolidColorBrush(Colors.Transparent);
			Path child = VisualTreeHelper.GetChild((Grid)sender, 0) as Path;
			if (child != null)
			{
				child.Stroke = new SolidColorBrush(Colors.White);
			}
		}

		private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
		{
			this._buttonClickable = true;
			((Grid)sender).Background = (((Grid)sender).Name == "CloseButton" ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.DimGray));
		}

		private void TopControls_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
		{
			if (this._buttonClickable)
			{
				MethodInfo method = base.GetType().GetMethod(string.Concat(((Grid)sender).Name, "_Click"));
				if (method == null)
				{
					return;
				}
				method.Invoke(this, null);
			}
		}
	}
}