SimulatorIoTMView.xaml.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using System.Collections.ObjectModel;
  3. using System.Windows;
  4. using System.Windows.Controls;
  5. using System.Windows.Controls.Primitives;
  6. using System.Windows.Data;
  7. using Aitex.Common.Util;
  8. using Aitex.Core.UI.MVVM;
  9. using MECF.Framework.Common.IOCore;
  10. using CyberX8_Core;
  11. using CyberX8_Simulator.Instances;
  12. namespace CyberX8_Simulator.Views
  13. {
  14. /// <summary>
  15. /// IoView.xaml 的交互逻辑
  16. /// </summary>
  17. public partial class SimulatorIoTMView : UserControl
  18. {
  19. public SimulatorIoTMView()
  20. {
  21. InitializeComponent();
  22. //if (SimulatorJetTM.CurrentTM==JetTMType.VenusSE)
  23. //{
  24. // port = 6831;
  25. //}
  26. DataContext = new IoViewModel(6831, "TM.PLC", PathManager.GetCfgDir() + $"_ioDefineVenus_MF.xml", "TM");
  27. this.IsVisibleChanged += IOView_IsVisibleChanged;
  28. }
  29. private void IOView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
  30. {
  31. if (this.DataContext == null)
  32. {
  33. }
  34. (DataContext as TimerViewModelBase).EnableTimer(IsVisible);
  35. }
  36. }
  37. }