| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 | using System.Collections.ObjectModel;using Aitex.Core.UI.MVVM;using FurnaceSimulator.Instances;using MECF.Framework.Common.IOCore;using System.Windows.Controls.Primitives;using System.Windows;using System.Windows.Data;using System;namespace FurnaceSimulator.Views{    public class IoButton : ToggleButton    {        public static readonly DependencyProperty ONProperty;        static IoButton()        {            ONProperty = DependencyProperty.Register("ON", typeof(bool), typeof(IoButton));        }        public bool ON        {            get { return (bool)GetValue(ONProperty); }            set { SetValue(ONProperty, value); }        }    }    public class BoolBackgroundConverter : IValueConverter    {        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)        {            bool? ret = (bool?)value;            return ret.HasValue && ret.Value ? "LightBlue" : "Transparent";        }        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)        {            return null;        }    }    public class IoViewModel : TimerViewModelBase    {        public SimulatorPlc Plc { get; set; }        public ObservableCollection<NotifiableIoItem> DIs { get; set; }        public ObservableCollection<NotifiableIoItem> DOs { get; set; }        public ObservableCollection<NotifiableIoItem> AIs { get; set; }        public ObservableCollection<NotifiableIoItem> AOs { get; set; }        public IoViewModel(int port, string source, string ioMapPathFile, string module) : base(nameof(IoViewModel))        {            Plc = new SimulatorPlc(port, source, ioMapPathFile, module);            DIs = Plc.DiItemList;            DOs = Plc.DoItemList;            AIs = Plc.AiItemList;            AOs = Plc.AoItemList;        }        protected override void Poll()        {        }    }}
 |