using System; using System.Collections.ObjectModel; using System.Configuration; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; using Aitex.Common.Util; using Aitex.Core.UI.MVVM; using MECF.Framework.Common.IOCore; using Venus_Core; using Venus_Simulator.Instances; namespace Venus_Simulator.Views { /// /// IoView.xaml 的交互逻辑 /// public partial class SimulatorIoTMView : UserControl { public SimulatorIoTMView() { InitializeComponent(); //if (SimulatorJetTM.CurrentTM==JetTMType.VenusSE) //{ // port = 6831; //} var section = ConfigurationManager.GetSection("customSettings") as System.Collections.Specialized.NameValueCollection; ConfigType type = (ConfigType)Convert.ToInt32(section["SimulatorType"]); if (type == ConfigType.Kepler2200 || type == ConfigType.Kepler2300) DataContext = new IoViewModel(6834, "TM.PLC", PathManager.GetCfgDir() + $"_ioDefineVenus_MF.xml", "TM"); else DataContext = new IoViewModel(6831, "TM.PLC", PathManager.GetCfgDir() + $"_ioDefineVenus_MF.xml", "TM"); this.IsVisibleChanged += IOView_IsVisibleChanged; } private void IOView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if (this.DataContext == null) { } (DataContext as TimerViewModelBase).EnableTimer(IsVisible); } } }