private void DataCollect_DataReceived(object sender, AddressDataReceivedEventArgs e) { if (!(e?.AddressDatas?.Count > 0)) { return; } try { //Transfer foreach (var transfer in transfers) { //transfer.Transfer(); } //Log CsvHelper.WriteColumnCsvFile(e.AddressDatas, e.DeviceName); //Event DataReceived?.Invoke(sender, e); } catch (Exception ex) { logger.Error($"ex={ex}"); } }
private void DataCollect_DataReceived(object sender, AddressDataReceivedEventArgs e) { foreach (var item in e.AddressDatas) { var addressData = AddressDataWrappers?.FirstOrDefault(m => m.VariableId == item.VariableId); if (addressData != null) { if (addressData.Value1 == null) { addressData.Value1 = item.Value; } else if (addressData.Value2 == null) { addressData.Value2 = item.Value; } else if (addressData.Value3 == null) { addressData.Value3 = item.Value; } else if (addressData.Value4 == null) { addressData.Value4 = item.Value; } else if (addressData.Value5 == null) { addressData.Value5 = item.Value; } else { addressData.Value1 = item.Value; addressData.Value2 = null; addressData.Value3 = null; addressData.Value4 = null; addressData.Value5 = null; } } } }
public void OnDataReceived(object sender, AddressDataReceivedEventArgs e) { DataReceived?.Invoke(sender, e); }