using Agger.Registro; using Gestor.Application.Helpers; using Gestor.Application.Model.Ajuda; using Gestor.Application.ViewModels.Drawer.Ajuda; using Gestor.Application.ViewModels.Generic; using Gestor.Application.Views.Generic; using System; using System.CodeDom.Compiler; using System.ComponentModel; using System.Diagnostics; using System.Runtime.CompilerServices; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Markup; namespace Gestor.Application.Drawers.Ajuda { public class BoletosNotasDrawerView : BaseUserControl, IComponentConnector, IStyleConnector { internal System.Windows.Controls.ProgressBar ProgressBar; internal ComboBox StatusCbo; internal DataGrid BoletosGrid; internal DataGridTemplateColumn BaixarBoletoColumn; internal DataGridTextColumn PagamentoColumn; internal ItemsControl BoletoDisponivel; internal TextBlock TxtBoletoDisponivel; private bool _contentLoaded; public BoletosNotasViewModel ViewModel { get; set; } public BoletosNotasDrawerView() { this.ViewModel = new BoletosNotasViewModel(); base.DataContext = this.ViewModel; this.InitializeComponent(); this.StatusCbo.SelectedIndex = 0; } private void ExibirBoleto_OnClick(object sender, RoutedEventArgs e) { Boleto selectedItem = (Boleto)this.BoletosGrid.SelectedItem; if ((selectedItem.Vencimento - Funcoes.GetNetworkTime()).TotalDays > 10) { return; } Process.Start(string.Format("{0}billet/id/{1}", Address.get_ApiBoletoAgger(), selectedItem.IdBoleto)); } private void ExibirNota_OnClick(object sender, RoutedEventArgs e) { Process.Start(((Boleto)this.BoletosGrid.SelectedItem).Nota ?? ""); } private void Fechar_OnClick(object sender, RoutedEventArgs e) { this.ViewModel.CloseDrawer(); } [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/drawers/ajuda/boletosnotasdrawerview.xaml", UriKind.Relative)); } private void SelectedStatus_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { if (this.StatusCbo.SelectedItem == null) { return; } this.ViewModel.WorkOnSelectedStatus(this.StatusCbo.SelectedItem.ToString()); this.PagamentoColumn.Visibility = (this.StatusCbo.SelectedItem.ToString() == "PENDENTES" ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible); this.BaixarBoletoColumn.Visibility = (this.StatusCbo.SelectedItem.ToString() == "PENDENTES" ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); this.BoletoDisponivel.Visibility = (this.StatusCbo.SelectedItem.ToString() == "PENDENTES" ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); } [DebuggerNonUserCode] [EditorBrowsable(EditorBrowsableState.Never)] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: { this.ProgressBar = (System.Windows.Controls.ProgressBar)target; return; } case 2: { ((Button)target).Click += new RoutedEventHandler(this.Fechar_OnClick); return; } case 3: { this.StatusCbo = (ComboBox)target; this.StatusCbo.SelectionChanged += new SelectionChangedEventHandler(this.SelectedStatus_OnSelectionChanged); return; } case 4: { this.BoletosGrid = (DataGrid)target; return; } case 5: { this.BaixarBoletoColumn = (DataGridTemplateColumn)target; return; } case 6: case 7: { this._contentLoaded = true; return; } case 8: { this.PagamentoColumn = (DataGridTextColumn)target; return; } case 9: { this.BoletoDisponivel = (ItemsControl)target; return; } case 10: { this.TxtBoletoDisponivel = (TextBlock)target; return; } default: { this._contentLoaded = true; return; } } } [DebuggerNonUserCode] [EditorBrowsable(EditorBrowsableState.Never)] [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target) { if (connectionId == 6) { ((Button)target).Click += new RoutedEventHandler(this.ExibirBoleto_OnClick); return; } if (connectionId != 7) { return; } ((Button)target).Click += new RoutedEventHandler(this.ExibirNota_OnClick); } } }