| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 | 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{    /// <summary>    /// SimulatorPMAIOView.xaml 的交互逻辑    /// </summary>    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;        }    }}
 |