using Assinador.Infrastructure.Helpers; using CurrencyTextBoxControl; using Gestor.Application.ViewModels.Financeiro; using Gestor.Common.Validation; using Gestor.Model.Domain.Financeiro; 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.Input; using System.Windows.Markup; namespace Gestor.Application.Componentes { public class DialogTransferencia : UserControl, IComponentConnector { internal ComboBox ContaOrigemBox; internal CurrencyTextBox ValorBox; internal DatePicker VencimentoBox; internal ComboBox ContaDestinoBox; private bool _contentLoaded; private TranferenciaViewModel ViewModel { get; } public DialogTransferencia(Transferencia transferencia) { this.ViewModel = new TranferenciaViewModel(transferencia); base.DataContext = this.ViewModel; this.InitializeComponent(); } private void DataAtual_OnDoubleClick(object sender, RoutedEventArgs e) { ((DatePicker)sender).SelectedDate = new DateTime?(Functions.GetNetworkTime().Date); } public void DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) { DatePicker datePicker = (DatePicker)sender; datePicker.Text = ValidationHelper.FormatDate(datePicker.Text); } public void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key != Key.Return) { return; } DatePicker str = (DatePicker)sender; DateTime date = Functions.GetNetworkTime().Date; str.Text = date.ToString("dd/MM/yyyy"); } [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/componentes/dialogtransferencia.xaml", UriKind.Relative)); } [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.ContaOrigemBox = (ComboBox)target; return; } case 2: { this.ValorBox = (CurrencyTextBox)target; return; } case 3: { this.VencimentoBox = (DatePicker)target; this.VencimentoBox.PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown); this.VencimentoBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); this.VencimentoBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick); return; } case 4: { this.ContaDestinoBox = (ComboBox)target; return; } } this._contentLoaded = true; } } }