SimulatorIo2View.xaml.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 VirgoSimulator.Instances;
  11. namespace VirgoSimulator.Views
  12. {
  13. /// <summary>
  14. /// IoView.xaml 的交互逻辑
  15. /// </summary>
  16. public partial class SimulatorIo2View : UserControl
  17. {
  18. public SimulatorIo2View()
  19. {
  20. InitializeComponent();
  21. var ioFileName = "_ioDefineVirgo.xml";
  22. if (AppSettingHelper.IsVirgoR()) ioFileName = "_ioDefineVirgo_R.xml";
  23. DataContext = new IoViewModel(6732, "PMB.PLC", PathManager.GetCfgDir() + ioFileName, "PMB");
  24. this.IsVisibleChanged += IOView_IsVisibleChanged;
  25. }
  26. private void IOView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
  27. {
  28. if (this.DataContext == null)
  29. {
  30. }
  31. (DataContext as TimerViewModelBase).EnableTimer(IsVisible);
  32. }
  33. }
  34. }