using System.Collections.ObjectModel; using Aitex.Core.UI.MVVM; using SicSimulator.Instances; using MECF.Framework.Common.IOCore; using MECF.Framework.Simulator.Core.IoProviders; namespace SicSimulator.Views { public class IoViewModel : TimerViewModelBase { public SimulatorModulePlc PlcModule { get; set; } public SimulatorIO PlcSystem { get; set; } public ObservableCollection DIs { get; set; } public ObservableCollection DOs { get; set; } public ObservableCollection AIs { get; set; } public ObservableCollection AOs { get; set; } public IoViewModel(int port, string source, string ioMapPathFile, string module) : base(nameof(IoViewModel)) { if (string.IsNullOrEmpty(module) || module == "TM") { PlcSystem = new SimulatorIO(port, source, ioMapPathFile); DIs = PlcSystem.DiItemList; DOs = PlcSystem.DoItemList; AIs = PlcSystem.AiItemList; AOs = PlcSystem.AoItemList; } else { PlcModule = new SimulatorModulePlc(port, source, ioMapPathFile, module); DIs = PlcModule.DiItemList; DOs = PlcModule.DoItemList; AIs = PlcModule.AiItemList; AOs = PlcModule.AoItemList; } } protected override void Poll() { } } }