HstOcrReaderView.xaml.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. using Aitex.Core.UI.MVVM;
  17. using MECF.Framework.Simulator.Core.Commons;
  18. using MECF.Framework.Simulator.Core.Driver;
  19. namespace MECF.Framework.Simulator.Core.Aligners
  20. {
  21. /// <summary>
  22. /// HstOcrReaderView.xaml 的交互逻辑
  23. /// </summary>
  24. public partial class HstOcrReaderView : UserControl
  25. {
  26. public static readonly DependencyProperty PortProperty = DependencyProperty.Register(
  27. "Port", typeof(int), typeof(HstOcrReaderView),
  28. new FrameworkPropertyMetadata(23, FrameworkPropertyMetadataOptions.AffectsRender));
  29. public int Port
  30. {
  31. get
  32. {
  33. return (int)this.GetValue(PortProperty);
  34. }
  35. set
  36. {
  37. this.SetValue(PortProperty, value);
  38. }
  39. }
  40. public HstOcrReaderView()
  41. {
  42. InitializeComponent();
  43. this.Loaded += OnViewLoaded;
  44. }
  45. private void OnViewLoaded(object sender, RoutedEventArgs e)
  46. {
  47. if (DataContext == null)
  48. {
  49. this.DataContext = new HstOcrReaderViewModel(Port);
  50. }
  51. (DataContext as TimerViewModelBase).Start();
  52. }
  53. }
  54. class HstOcrReaderViewModel : SocketDeviceViewModel
  55. {
  56. public string Title
  57. {
  58. get { return "Hst Ocr Reader Simulator"; }
  59. }
  60. public HstOcrReaderViewModel(int port) : base("HstOcrReaderViewModel")
  61. {
  62. Init(new HstOcrReaderSimulator(port));
  63. }
  64. }
  65. }