| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- using Muchinfo.MTPClient.Data.Model.Delivery;
- using Muchinfo.MTPClient.Delivery.ViewModels;
- using System;
- using System.Text;
- using System.Windows;
- using System.Windows.Input;
- using Xceed.Wpf.Toolkit;
- namespace Muchinfo.MTPClient.Delivery.Views
- {
- /// <summary>
- /// Description for DeliveryMatchView.
- /// </summary>
- public partial class DeliveryMatchView : Window
- {
- public bool occur = false;
- /// <summary>
- /// Initializes a new instance of the DeliveryMatchView class.
- /// </summary>
- public DeliveryMatchView(DeliveryEntrustOrder model)
- {
- InitializeComponent();
- this.DataContext = new DeliveryMatchViewModel(model);
-
- }
- public void drag_MouseLeftButtonDown(object sender, MouseButtonEventArgs args)
- {
- this.DragMove();
- }
- 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.Contains(".") && txtInput.Text.Length >= 8)
- {
- e.Handled = true;
- }
- else if (!txtInput.Text.Contains(".") && txtInput.Text.Length >= 6)
- {
- e.Handled = true;
- }
-
-
- }
- private bool IsNumberKey(Key inKey)
- {
- if (inKey < Key.D0 || inKey > Key.D9)
- {
- if (inKey < Key.NumPad0 || inKey > Key.NumPad9)
- {
- return false;
- }
- }
- return true;
- }
- private bool IsDelOrBackspaceOrTabKey(Key inKey)
- {
- return inKey == Key.Delete || inKey == Key.Back || inKey == Key.Tab;
- }
- private string LeaveOnlyNumbers(String inString)
- {
- occur = false;
- StringBuilder ans = new StringBuilder();
- for (int i = 0; i < inString.Length; ++i)
- {
- if (System.Text.RegularExpressions.Regex.IsMatch(inString[i].ToString(), "^[0-9\\.]*$"))
- {
- if (inString[i] == '.')
- {
- if (!occur)
- {
- occur = true;
- ans.Append(inString[i]);
- }
- }
- else ans.Append(inString[i]);
- }
- }
- return ans.ToString();
- }
-
- }
- }
|