using Gestor.Application.Helpers; using Gestor.Application.ViewModels.Financeiro; using Gestor.Application.ViewModels.Generic; using Gestor.Application.Views.Generic; using Gestor.Model.Domain.Financeiro; using Gestor.Model.Domain.Generic; 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.Markup; namespace Gestor.Application.Views.Financeiro { public class PlanoView : BaseUserControl, IComponentConnector { private bool _contentLoaded; public PlanoViewModel ViewModel { get; set; } [DebuggerNonUserCode] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] internal Delegate _CreateDelegate(Type delegateType, string handler) { return Delegate.CreateDelegate(delegateType, this, handler); } public PlanoView(Plano plano) { this.ViewModel = new PlanoViewModel(plano); base.DataContext = this.ViewModel; this.InitializeComponent(); } private void Alterar_OnClick(object sender, RoutedEventArgs e) { this.ViewModel.Cancel = (Plano)this.ViewModel.SelectedPlano.Clone(); this.ViewModel.Alterar(true); } private void Cancelar_OnClick(object sender, RoutedEventArgs e) { this.ViewModel.Cancelar(); } private void Incluir_OnClick(object sender, RoutedEventArgs e) { this.ViewModel.Incluir(); } [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/planoview.xaml", UriKind.Relative)); } private async void Salvar_OnClick(object sender, RoutedEventArgs e) { bool flag; this.ViewModel.Loading(true); List> keyValuePairs = await this.ViewModel.Salvar(); this.ValidateFields(keyValuePairs, true); 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) { switch (connectionId) { case 1: { ((MenuItem)target).Click += new RoutedEventHandler(this.Incluir_OnClick); return; } case 2: { ((MenuItem)target).Click += new RoutedEventHandler(this.Alterar_OnClick); return; } case 3: { ((MenuItem)target).Click += new RoutedEventHandler(this.Salvar_OnClick); return; } case 4: { ((MenuItem)target).Click += new RoutedEventHandler(this.Cancelar_OnClick); return; } } this._contentLoaded = true; } } }