| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- using Muchinfo.MTPClient.Data.Model.Delivery;
- using Muchinfo.MTPClient.Delivery.ViewModels;
- using System.Windows;
- using System.Windows.Input;
- using Xceed.Wpf.Toolkit;
- namespace Muchinfo.MTPClient.Delivery.Views
- {
- /// <summary>
- /// Description for NDeliveryOrderView.
- /// </summary>
- public partial class NDeliveryOrderView : Window
- {
- /// <summary>
- /// Initializes a new instance of the NDeliveryOrderView class.
- /// </summary>
- public NDeliveryOrderView()
- {
- InitializeComponent();
- }
- public NDeliveryOrderView(DeliveryOrderMessage parameter)
- {
- InitializeComponent();
- this.DataContext = new NDeliveryOrderViewModel(parameter);
- }
- private void SelectQty_KeyDown(object sender, KeyEventArgs e)
- {
- var txtInput = (DecimalUpDown)sender;
- if ((e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9) || (e.Key >= Key.D0 && e.Key <= Key.D9))
- {
- e.Handled = false;
- }
- else if ((e.Key == Key.Decimal || e.Key == Key.OemPeriod))
- {
- e.Handled = false;
- }
- else
- {
- e.Handled = true;
- }
- if (txtInput.Text!=null && txtInput.Text.Contains(".") && txtInput.Text.Length >= 8)
- {
- e.Handled = true;
- }
- else if (txtInput.Text!=null && !txtInput.Text.Contains(".") && txtInput.Text.Length >= 6)
- {
- e.Handled = true;
- }
- if (!string.IsNullOrEmpty(txtInput.Text))
- {
- var current = decimal.Parse(txtInput.Text);
- if (current > txtInput.Maximum)
- {
- txtInput.Text = txtInput.Maximum.ToString();
- }
- }
- }
- private void DecimalUpDown_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
- {
- var txtInput = (DecimalUpDown)sender;
- if (txtInput.Text.Length >= 6)
- {
- e.Handled = true;
- }
- else
- {
- e.Handled = false;
- }
- }
- }
- }
|