SimulatorCard1View.xaml.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. switch (VersionNo)
  18. {
  19. case "005":
  20. DataContext = new IoViewModelBase(16731, "System.dio000", PathManager.GetCfgDir() + "_ioDefine2.xml");
  21. break;
  22. case "006":
  23. DataContext = new IoViewModelBase(16731, "System.dio000", PathManager.GetCfgDir() + "_ioDefine3.xml");
  24. break;
  25. default:
  26. DataContext = new IoViewModelBase(16731, "System.dio000", PathManager.GetCfgDir() + "_ioDefine1.xml");
  27. break;
  28. }
  29. this.IsVisibleChanged += IOView_IsVisibleChanged;
  30. }
  31. private void IOView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
  32. {
  33. if (this.DataContext == null)
  34. {
  35. }
  36. (DataContext as TimerViewModelBase).EnableTimer(IsVisible);
  37. }
  38. }
  39. }