public void SetValue(double value) { Value = value; var args = new SensorValueChangedEventArgs { Value = value }; SensorValueChanged?.Invoke(args); }
private void InstanceOnNewMessageArrived(Message msg) { if (SensorValueChanged != null) { if (msg != null && msg.Command != String.Empty) { try { if (msg.Response.FunctionIndex == ReaderFunctionIndex.ToString()) //update the events if the this is the right sensor { CurrentValue = Convert.ToInt32(Response.GetResponse(msg).Value); SensorValueChanged?.Invoke(Convert.ToInt32(Response.GetResponse(msg).Value)); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } } }
protected virtual void OnSensorValueChanged(SensorValueChangedEventArgs e) => SensorValueChanged?.Invoke(this, e);
private void OnSensorValueChanged(SensorValue e) { SensorValueChanged?.Invoke(this, e); }