BrooksMag7RobotView.xaml.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 Aitex.Core.Utilities;
  18. using MECF.Framework.Simulator.Core.Aligners;
  19. using MECF.Framework.Simulator.Core.Commons;
  20. using MECF.Framework.Simulator.Core.Driver;
  21. namespace MECF.Framework.Simulator.Core.Robots
  22. {
  23. /// <summary>
  24. /// BrooksMag7RobotView.xaml 的交互逻辑
  25. /// </summary>
  26. public partial class BrooksMag7RobotView : UserControl
  27. {
  28. public BrooksMag7RobotView()
  29. {
  30. InitializeComponent();
  31. this.DataContext = new BrooksMag7RobotViewModel();
  32. this.Loaded += OnViewLoaded;
  33. }
  34. private void OnViewLoaded(object sender, RoutedEventArgs e)
  35. {
  36. (DataContext as TimerViewModelBase).Start();
  37. }
  38. }
  39. class BrooksMag7RobotViewModel : SocketDeviceViewModel
  40. {
  41. public string Title
  42. {
  43. get { return "Brooks Mag7 Robot Simulator"; }
  44. }
  45. private BrooksMag7RobotSimulator _robot;
  46. public bool IsFailed
  47. {
  48. get
  49. {
  50. return _robot.Failed;
  51. }
  52. set
  53. {
  54. _robot.Failed = value;
  55. }
  56. }
  57. //private string _value;
  58. [IgnorePropertyChange]
  59. public string ErrorCode
  60. {
  61. get
  62. {
  63. return _robot.ErrorCode;
  64. }
  65. set
  66. {
  67. _robot.ErrorCode = value;
  68. }
  69. }
  70. public bool EventChecked
  71. {
  72. get
  73. {
  74. return _robot.EventChecked;
  75. }
  76. set
  77. {
  78. _robot.EventChecked = value;
  79. if (value) EventCode = "_EVENT ROBOR 02610 0003 B -00028 000028 000028 -00002\r";
  80. else EventCode = null;
  81. }
  82. }
  83. [IgnorePropertyChange]
  84. public string EventCode
  85. {
  86. get
  87. {
  88. return _robot.EventCode;
  89. }
  90. set
  91. {
  92. _robot.EventCode = value;
  93. }
  94. }
  95. public BrooksMag7RobotViewModel() : base("BrooksMag7RobotViewModel")
  96. {
  97. _robot = new BrooksMag7RobotSimulator();
  98. Init(_robot);
  99. }
  100. }
  101. }