예제 #1
0
        private void DataStore_DataStoreWrittenTo(object sender, DataStoreEventArgs e)
        {
            if (e.ModbusDataType != ModbusDataType.HoldingRegister) return;

            var data = (DataStore)sender;
            var newValue = data.HoldingRegisters[e.StartAddress + 1];

            modifiedRegister = new Register()
            {
                Address = e.StartAddress,
                Value = newValue
            };

            Debugger.Log(1, "Debug", modifiedRegister.Value + " | " + newValue);
            context.Post((a) => ValueWasWritten?.Invoke(null, modifiedRegister), null);
        }
예제 #2
0
 private void OnRegisterValueChanged(object sender, Register modifiedRegister)
 {
     var item = FindElementInCollection(ViewData.MonitoredRegisters, modifiedRegister.Address);
     if (item != null) item.Value = modifiedRegister.Value;
 }