public void CreateOpcSensorInfo(IOpcSensorInfo aOpcSensorInfo) { if (aOpcSensorInfo == null) { throw new ArgumentNullException("aOpcSensorInfo"); } if (opcSensorInfos.Any(s => s.Id == aOpcSensorInfo.Id || s.Name.Equals(aOpcSensorInfo.Name))) { throw new ArgumentException( "Датчик с таким идентификатором или именем уже есть: " + aOpcSensorInfo.Name); } opcSensorInfos.Add(aOpcSensorInfo); foreach (var listener in listeners) { listener.OnSensorCreated(this, aOpcSensorInfo.Id); } }
public void OnSensorCreated(IDataProviderConfiguration aConfiguration, int aSensorId) { CreatedSensor = aConfiguration.ReadOpcSensorInfoById(aSensorId); }
public void DeleteOpcSensorInfo(IOpcSensorInfo aOpcSensorInfo) { throw new System.NotImplementedException(); }
private int GetSensorId(IOpcSensorInfo aSensorInfo) { var sensorInfo = sensorConfiguration.ReadSensorInfoByName(aSensorInfo.Name); if (sensorInfo == null) { throw new ArgumentException("Настройки OPC: Датчика с именем " + aSensorInfo.Name + " " + "не найдено в настройках приложения."); } return sensorInfo.GetId(); }