private void UpdateDetect() { var nextDetectState = Pins.Any(x => x.IsSensing); if (nextDetectState != detectState) { detectState = nextDetectState; if (nextDetectState) { Detect?.Invoke(); } } }