TazmoRobotSerialView.xaml.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using Aitex.Core.UI.MVVM;
  2. using Aitex.Core.Utilities;
  3. using MECF.Framework.Simulator.Core.Commons;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Data;
  12. using System.Windows.Documents;
  13. using System.Windows.Input;
  14. using System.Windows.Media;
  15. using System.Windows.Media.Imaging;
  16. using System.Windows.Navigation;
  17. using System.Windows.Shapes;
  18. namespace MECF.Framework.Simulator.Core.Robots
  19. {
  20. /// <summary>
  21. /// TazmoRobotView.xaml 的交互逻辑
  22. /// </summary>
  23. public partial class TazmoRobotSerialView : UserControl
  24. {
  25. public TazmoRobotSerialView()
  26. {
  27. InitializeComponent();
  28. this.DataContext = new TazmoRobotSerialViewModel();
  29. this.Loaded += OnViewLoaded;
  30. }
  31. private void OnViewLoaded(object sender, RoutedEventArgs e)
  32. {
  33. (DataContext as TimerViewModelBase).Start();
  34. }
  35. }
  36. class TazmoRobotSerialViewModel : SerialPortDeviceViewModel
  37. {
  38. public string Title
  39. {
  40. get { return "TazmoRobotSerial Simulator"; }
  41. }
  42. private TazmoRobotSerialSimulator _robot;
  43. public bool IsFailed
  44. {
  45. get
  46. {
  47. return _robot.Failed;
  48. }
  49. set
  50. {
  51. _robot.Failed = value;
  52. }
  53. }
  54. //private string _value;
  55. [IgnorePropertyChange]
  56. public string ResultValue
  57. {
  58. get
  59. {
  60. return _robot.ResultValue;
  61. }
  62. set
  63. {
  64. _robot.ResultValue = value;
  65. }
  66. }
  67. public TazmoRobotSerialViewModel() : base("TazmoRobotSerialViewModel")
  68. {
  69. _robot = new TazmoRobotSerialSimulator();
  70. Init(_robot);
  71. }
  72. }
  73. }