DeliveryOrderView.xaml.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System.Windows.Controls;
  2. using Muchinfo.MTPClient.Delivery.ViewModels;
  3. using System.Windows;
  4. using System.Windows.Input;
  5. using Xceed.Wpf.Toolkit;
  6. using Muchinfo.MTPClient.Infrastructure.Helpers;
  7. using Muchinfo.MTPClient.Data.Enums;
  8. using Muchinfo.MTPClient.Data.Model.Delivery;
  9. namespace Muchinfo.MTPClient.Delivery.Views
  10. {
  11. /// <summary>
  12. /// Description for DeliveryOrderView.
  13. /// </summary>
  14. public partial class DeliveryOrderView : Window
  15. {
  16. /// <summary>
  17. /// Initializes a new instance of the DeliveryOrderView class.
  18. /// </summary>
  19. public DeliveryOrderView()
  20. {
  21. InitializeComponent();
  22. this.DataContext = new DeliveryOrderViewModel();
  23. //MessengerHelper.DefaultRegister<int>(this, MessengerTokens.DeliveryBuyOrSellChanged, BuyOrSellChangedEvent);
  24. }
  25. public DeliveryOrderView(DeliveryOrderMessage info)
  26. {
  27. InitializeComponent();
  28. this.DataContext = new DeliveryOrderViewModel(info);
  29. }
  30. public void drag_MouseLeftButtonDown(object sender, MouseButtonEventArgs args)
  31. {
  32. this.DragMove();
  33. }
  34. public void CloseWindow(object sender, RoutedEventArgs args)
  35. {
  36. this.Close();
  37. }
  38. private void DecimalUpDown_KeyDown(object sender, KeyEventArgs e)
  39. {
  40. var txtInput = (DecimalUpDown)sender;
  41. if ((e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9) || (e.Key >= Key.D0 && e.Key <= Key.D9 ))
  42. {
  43. if (txtInput.Text.Length >= 6)
  44. {
  45. e.Handled = true;
  46. }
  47. else
  48. {
  49. e.Handled = false;
  50. }
  51. }
  52. else
  53. {
  54. e.Handled = true;
  55. }
  56. }
  57. }
  58. }