Sic02-new/SicSimulator/Views/IoViewModel.cs

50 lines
1.5 KiB
C#
Raw Normal View History

2023-07-25 14:28:00 +08:00
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<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))
{
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()
{
}
}
}