SimulatorCard1View.xaml.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.Configuration;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using Aitex.Common.Util;
  5. using Aitex.Core.UI.MVVM;
  6. namespace EfemSimulator.Views
  7. {
  8. /// <summary>
  9. /// IoView.xaml 的交互逻辑
  10. /// </summary>
  11. public partial class SimulatorCard1View : UserControl
  12. {
  13. public SimulatorCard1View()
  14. {
  15. InitializeComponent();
  16. var VersionNo = ConfigurationManager.AppSettings["VersionNumber"].ToString();
  17. if (VersionNo == "005")
  18. {
  19. DataContext = new IoViewModelBase(16731, "System.dio000",
  20. PathManager.GetCfgDir() + "_ioDefine2.xml");
  21. }
  22. else
  23. {
  24. DataContext = new IoViewModelBase(16731, "System.dio000",
  25. PathManager.GetCfgDir() + "_ioDefine1.xml");
  26. }
  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. }