PowerSupplierView.xaml.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System.Windows;
  2. using System.Windows.Controls;
  3. using System.Windows.Input;
  4. using System.Collections.Generic;
  5. using Aitex.Core.UI.MVVM;
  6. using Aitex.Core.Utilities;
  7. using MECF.Framework.Simulator.Core.Commons;
  8. using CyberX8_Simulator.Devices;
  9. using System.Threading;
  10. namespace CyberX8_Simulator.Views
  11. {
  12. /// <summary>
  13. /// Interaction logic for PowerSupplierView.xaml
  14. /// </summary>
  15. public partial class PowerSupplierView : UserControl
  16. {
  17. public PowerSupplierView()
  18. {
  19. InitializeComponent();
  20. this.Loaded += OnViewLoaded;
  21. }
  22. private void OnViewLoaded(object sender, RoutedEventArgs e)
  23. {
  24. (DataContext as TimerViewModelBase)?.Start();
  25. }
  26. }
  27. class PowerSupplierViewModel : SocketDeviceViewModel
  28. {
  29. public string Title
  30. {
  31. get { return "PowerSupplier Simulator"; }
  32. }
  33. private PowerSupplierSocketSimulator _sim;
  34. public PowerSupplierViewModel(string str) : base("PowerSupplierViewModel")
  35. {
  36. int.TryParse(str, out int port);
  37. _sim=new PowerSupplierSocketSimulator(port);
  38. Init(_sim);
  39. }
  40. }
  41. }