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> 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); } } } }