public AutomaticMode(IShotGlassPositionSettingRepository shotGlassPositionSettingRepository, IXAxis xAxis, IYAxis yAxis, ISpiritDispenserControl spiritDispenserControl, IEmergencyStop emergencyStop) { _currentStatus = new BehaviorSubject <Status>(Status.NotReady); _shotGlassPositionSettingRepository = shotGlassPositionSettingRepository; _X_Axis = xAxis; _Y_Axis = yAxis; _spiritDispenserControl = spiritDispenserControl; _emergencyStop = emergencyStop; _emergencyStop.EmergencyStopPressedChanged += (estop) => CalculateStatuts(); var components = new List <IObservable <Status> >(); components.Add(_X_Axis.GetStatusObservable()); components.Add(_Y_Axis.GetStatusObservable()); components.Add(_spiritDispenserControl.GetStatusObservable()); components.CombineLatest(lastStates => lastStates.All(state => state == Status.Ready)) .Subscribe(areComponentsReady => { _areComponentsReady = areComponentsReady; CalculateStatuts(); }); }
public StatusObserver( IAutomaticMode automatic, IXAxis xAxis, IYAxis yAxis, ISpiritDispenserControl spiritDispenserControl, IStatusLamp statusLamp) { _statusObservables = new List <IObservable <Status> >(); _statusObservables.Add(spiritDispenserControl.GetStatusObservable()); _statusObservables.Add(xAxis.GetStatusObservable()); _statusObservables.Add(yAxis.GetStatusObservable()); _statusObservables.Add(automatic.GetStatusObservable()); _statusLamp = statusLamp; }