public void ConnectTo(DigitalSignal digitalSignal) { if (digitalSignal == null) { throw new ArgumentNullException(nameof(digitalSignal)); } if (_digitalSignal != null) { throw new InvalidOperationException("This DigitalSignalProvider is already connected."); } _digitalSignal = digitalSignal; _digitalSignal.Attach(this); // catch up with set level value if (Level != DigitalLevel.Floating) { var newLevel = Level; foreach (var level in new DigitalLevelCycler( DigitalLevelCycler.NextLevel(_digitalSignal.Level), newLevel)) { Level = level; _digitalSignal.OnNewProviderValue(this); } } }
public void ConnectTo(DigitalSignal digitalSignal) { if (digitalSignal == null) { throw new ArgumentNullException(nameof(digitalSignal)); } if (_digitalSignal != null) { throw new InvalidOperationException("DigitalConsumer is already connected."); } _digitalSignal = digitalSignal; _digitalSignal.Attach(this); _digitalSignal.OnChanged += DigitalSignal_OnChanged; }
public void ConnectTo(DigitalSignal digitalSignal) { if (digitalSignal == null) { throw new ArgumentNullException(nameof(digitalSignal)); } if (_digitalSignal != null) { throw new InvalidOperationException("This DigitalSignalProvider is already connected."); } _digitalSignal = digitalSignal; _digitalSignal.Attach(this); // catch up with set level value if (Level != DigitalLevel.Floating) { SetNewLevel(Level); } }