コード例 #1
0
ファイル: AutomaticMode.cs プロジェクト: TomaT3/SpiritSpender
        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();
            });
        }
コード例 #2
0
        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;
        }