using System.Configuration; using System.Windows; using System.Windows.Controls; using Aitex.Common.Util; using Aitex.Core.UI.MVVM; namespace EfemSimulator.Views { /// /// IoView.xaml 的交互逻辑 /// public partial class SimulatorCard1View : UserControl { public SimulatorCard1View() { InitializeComponent(); var VersionNo = ConfigurationManager.AppSettings["VersionNumber"].ToString(); if (VersionNo == "005") { DataContext = new IoViewModelBase(16731, "System.dio000", PathManager.GetCfgDir() + "_ioDefine2.xml"); } else { DataContext = new IoViewModelBase(16731, "System.dio000", PathManager.GetCfgDir() + "_ioDefine1.xml"); } this.IsVisibleChanged += IOView_IsVisibleChanged; } private void IOView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if (this.DataContext == null) { } (DataContext as TimerViewModelBase).EnableTimer(IsVisible); } } }