FestoView.xaml.cs 1020 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using Aitex.Core.UI.MVVM;
  2. using CyberX8_Simulator.Devices;
  3. using MECF.Framework.Simulator.Core.Commons;
  4. using System.Windows;
  5. using System.Windows.Controls;
  6. namespace CyberX8_Simulator.Views
  7. {
  8. /// <summary>
  9. /// FestoView.xaml 的交互逻辑
  10. /// </summary>
  11. public partial class FestoView : UserControl
  12. {
  13. public FestoView()
  14. {
  15. InitializeComponent();
  16. this.Loaded += OnViewLoaded;
  17. }
  18. private void OnViewLoaded(object sender, RoutedEventArgs e)
  19. {
  20. (DataContext as TimerViewModelBase)?.Start();
  21. }
  22. }
  23. class FestoViewModel : SocketDeviceViewModel
  24. {
  25. public string Title
  26. {
  27. get { return "Festo Simulator"; }
  28. }
  29. private FestoSocketSimulator _sim;
  30. public FestoViewModel(string str) : base("FestoViewModel")
  31. {
  32. int.TryParse(str, out int port);
  33. _sim = new FestoSocketSimulator(port);
  34. Init(_sim);
  35. }
  36. }
  37. }