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(); switch (VersionNo) { case "005": DataContext = new IoViewModelBase(16731, "System.dio000", PathManager.GetCfgDir() + "_ioDefine2.xml"); break; case "006": DataContext = new IoViewModelBase(16731, "System.dio000", PathManager.GetCfgDir() + "_ioDefine3.xml"); break; default: DataContext = new IoViewModelBase(16731, "System.dio000", PathManager.GetCfgDir() + "_ioDefine1.xml"); break; } this.IsVisibleChanged += IOView_IsVisibleChanged; } private void IOView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if (this.DataContext == null) { } (DataContext as TimerViewModelBase).EnableTimer(IsVisible); } } }