EntrustOrderFrame.xaml.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using Muchinfo.MTPClient.Data.Enums;
  2. using Muchinfo.MTPClient.Data.Helper;
  3. using Muchinfo.MTPClient.Data.Model;
  4. using Muchinfo.MTPClient.Data.Model.Account;
  5. using Muchinfo.MTPClient.Trade.ViewModels.Unified;
  6. using System;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Input;
  10. using Xceed.Wpf.Toolkit;
  11. namespace Muchinfo.MTPClient.Trade.Views
  12. {
  13. /// <summary>
  14. /// EntrustOrderFrame.xaml 的交互逻辑
  15. /// </summary>
  16. public partial class EntrustOrderFrame : Window
  17. {
  18. public EntrustOrderFrame(QuoteGoods goods, Direction direction, ePriceMode priceMode = ePriceMode.PRICEMODE_MARKET)
  19. {
  20. InitializeComponent();
  21. this.DataContext = new EntrustOrderViewModel(goods, direction, priceMode);
  22. }
  23. public EntrustOrderFrame(OrderBase orderBase, ePriceMode priceMode = ePriceMode.PRICEMODE_MARKET)
  24. {
  25. InitializeComponent();
  26. this.DataContext = new EntrustOrderViewModel(orderBase, priceMode);
  27. }
  28. public EntrustOrderFrame()
  29. {
  30. InitializeComponent();
  31. }
  32. private void Window_MouseDown(object sender, MouseButtonEventArgs e)
  33. {
  34. if (e.LeftButton == MouseButtonState.Pressed)
  35. {
  36. DragMove();
  37. }
  38. }
  39. private void btnClose_Click(object sender, RoutedEventArgs e)
  40. {
  41. this.Close();
  42. }
  43. /// <summary>
  44. /// 使用new显示隐藏基类ShowDialog()方法
  45. /// 把ShowDialog方法抛到UI线程(解决弹出下单界面后报价牌行情不跳问题)
  46. /// </summary>
  47. new public void ShowDialog()
  48. {
  49. Application.Current.Dispatcher.BeginInvoke(new Action(() =>
  50. {
  51. base.ShowDialog();
  52. }));
  53. }
  54. private void DecimalUpDown_KeyDown(object sender, KeyEventArgs e)
  55. {
  56. if ((e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9) || (e.Key >= Key.D0 && e.Key <= Key.D9))
  57. {
  58. e.Handled = false;
  59. }
  60. else
  61. {
  62. e.Handled = true;
  63. }
  64. }
  65. private void Button_Click(object sender, RoutedEventArgs e)
  66. {
  67. //AppMessengerHelper.PopupNoticeMessage.Send(true);
  68. }
  69. }
  70. }