From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- .../Componentes/DialogTransferencia.cs | 110 +++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 Codemerx/Gestor.Application/Componentes/DialogTransferencia.cs (limited to 'Codemerx/Gestor.Application/Componentes/DialogTransferencia.cs') diff --git a/Codemerx/Gestor.Application/Componentes/DialogTransferencia.cs b/Codemerx/Gestor.Application/Componentes/DialogTransferencia.cs new file mode 100644 index 0000000..30f31c5 --- /dev/null +++ b/Codemerx/Gestor.Application/Componentes/DialogTransferencia.cs @@ -0,0 +1,110 @@ +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; + } + } +} \ No newline at end of file -- cgit v1.2.3