using Aitex.Common.Util; using Aitex.Core.UI.MVVM; using MECF.Framework.Common.IOCore; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace FurnaceSimulator.Views { /// /// SimulatorPMAIOView.xaml 的交互逻辑 /// public partial class SimulatorPlcFloatIOView : UserControl { public static readonly DependencyProperty PortProperty = DependencyProperty.Register( "Port", typeof(int), typeof(SimulatorPlcFloatIOView), new FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.AffectsRender)); public static readonly DependencyProperty SourceProperty = DependencyProperty.Register( "Source", typeof(string), typeof(SimulatorPlcFloatIOView), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender)); public static readonly DependencyProperty ModuleProperty = DependencyProperty.Register( "Module", typeof(string), typeof(SimulatorPlcFloatIOView), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender)); public static readonly DependencyProperty IoMapFileProperty = DependencyProperty.Register( "IoMapFile", typeof(string), typeof(SimulatorPlcFloatIOView), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender)); public int Port { get { return (int)this.GetValue(PortProperty); } set { this.SetValue(PortProperty, value); } } public string Source { get { return (string)this.GetValue(SourceProperty); } set { this.SetValue(SourceProperty, value); } } public string Module { get { return (string)this.GetValue(ModuleProperty); } set { this.SetValue(ModuleProperty, value); } } public string IoMapFile { get { return (string)this.GetValue(IoMapFileProperty); } set { this.SetValue(IoMapFileProperty, value); } } private void OnViewLoaded(object sender, RoutedEventArgs e) { if (DataContext == null) { DataContext = new IoViewModel(Port, Source, $"{PathManager.GetCfgDir()}{IoMapFile}", Module); (DataContext as TimerViewModelBase).Start(); } } public SimulatorPlcFloatIOView() { InitializeComponent(); this.Loaded += OnViewLoaded; } } }