Exemplo n.º 1
0
        public ViewModel_SimulationRunner()
        {
            // Fill in some defaults
            SimulationParameters = new ViewModel_SimulationParameters(96, 288, 3, 1, 10, 0);

            _SimulationTimer.Elapsed += _Simulationtimer_Elapsed;

            Arm             = new ViewModel_Arm();
            GrindStation    = new ViewModel_GrindStation();
            DispenseStation = new ViewModel_DispenseStation();

            // Tie in events when parts of the system have completed their job
            _Arm.OnArmUpdateEvent                  += new ViewModel_Arm.OnArmUpdateEventHandler(Arm_OnArmUpdateEventReceived);
            _Arm.OnGripUpdateEvent                 += new ViewModel_Arm.OnGripUpdateEventHandler(Arm_OnGripUpdateEventReceived);
            _GrindStation.OnGrindUpdateEvent       += new ViewModel_GrindStation.OnGrindUpdateEventHandler(GrindStation_OnGrindUpdateEventReceived);
            _DispenseStation.OnDispenseUpdateEvent += new ViewModel_DispenseStation.OnDispenseUpdateEventHandler(DispenseStation_OnDispenseUpdateEventReceived);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Received when the Dispenser has dispensed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="proceed"></param>
        /// <param name="message"></param>
        private void DispenseStation_OnDispenseUpdateEventReceived(ViewModel_DispenseStation sender, bool proceed, string message)
        {
            if (proceed)
            {
                // Is this the last fine material in the input vial?
                if (0 == ((_OutputRack.IDInUse + 1) % _SimulationParameters.OutputDivisionFactor))
                {
                    _InputRack.SetCurrentVialEmpty();
                }
                else
                {
                    // Update input vial
                    _InputRack.SetCurrentVialFullFine(_InputRack.GetCurrentVialWeight() - _SimulationParameters.TargetOutputVialWeight_mg);
                }

                // Update output vial of material
                _OutputRack.SetCurrentVialFullFine(_SimulationParameters.TargetOutputVialWeight_mg);

                DoProceed();
            }
            RaiseEventOnTopLevel(OnSimulationUpdateEvent, new object[] { this, message });
        }