HAtmRobotView.xaml.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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.HAtm
  22. {
  23. /// <summary>
  24. /// HAtmRobotView.xaml 的交互逻辑
  25. /// </summary>
  26. public partial class HAtmRobotView : UserControl
  27. {
  28. public HAtmRobotView()
  29. {
  30. InitializeComponent();
  31. this.DataContext = new HAtmRobotViewModel();
  32. this.Loaded += OnViewLoaded;
  33. }
  34. private void OnViewLoaded(object sender, RoutedEventArgs e)
  35. {
  36. (DataContext as TimerViewModelBase).Start();
  37. }
  38. private void ErrorCheckBox_Checked(object sender, RoutedEventArgs e)
  39. {
  40. var viewmodel = DataContext as HAtmRobotViewModel;
  41. if (viewmodel != null)
  42. viewmodel.SetError();
  43. }
  44. private void BusyCheckBox_Checked(object sender, RoutedEventArgs e)
  45. {
  46. var viewmodel = DataContext as HAtmRobotViewModel;
  47. if (viewmodel != null)
  48. viewmodel.SetBusy();
  49. }
  50. private void WaferPresentCheckBox_Checked(object sender, RoutedEventArgs e)
  51. {
  52. var viewmodel = DataContext as HAtmRobotViewModel;
  53. if (viewmodel != null)
  54. viewmodel.SetWaferPresent();
  55. }
  56. }
  57. class HAtmRobotViewModel : SocketDeviceViewModel
  58. {
  59. public string Title
  60. {
  61. get { return "HAtm Robot Simulator"; }
  62. }
  63. private HAtmRobotSimulator _robot;
  64. public bool IsError { get; set; }
  65. public bool IsBusy { get; set; }
  66. public bool IsWaferPresent { get; set; }
  67. public void SetError()
  68. {
  69. _robot.IsError = IsError;
  70. }
  71. public void SetBusy()
  72. {
  73. _robot.IsBusy = IsBusy;
  74. }
  75. public void SetWaferPresent()
  76. {
  77. _robot.IsWaferPresent = IsWaferPresent;
  78. }
  79. public HAtmRobotViewModel() : base("HAtmRobotViewModel")
  80. {
  81. _robot = new HAtmRobotSimulator();
  82. Init(_robot);
  83. }
  84. }
  85. }