/// <summary> /// Received when the arm has completed a movement /// </summary> /// <param name="sender"></param> /// <param name="proceed"></param> /// <param name="message"></param> private void Arm_OnArmUpdateEventReceived(ViewModel_Arm sender, bool proceed, string message) { if (proceed) { DoProceed(); } RaiseEventOnTopLevel(OnSimulationUpdateEvent, new object[] { this, message }); }
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); }
/// <summary> /// Received then the grip has completed a movement /// </summary> /// <param name="sender"></param> /// <param name="proceed"></param> /// <param name="message"></param> private void Arm_OnGripUpdateEventReceived(ViewModel_Arm sender, bool proceed, int index, Model_Arm.GripPosition grip, Model_Rack.RackPurpose rack, string message) { if (proceed) { if (SimulationState.STAGE1_PICK_UP_INPUT_VIAL == _CurrentState) { // Belt and braces if (Model_Rack.RackPurpose.INPUT == rack) { // Just picked up from input so set current input ID _InputRack.SetCurrentID(index); _RefreshInput = false; } } if (SimulationState.STAGE6_PICK_UP_OUTPUT_VIAL == _CurrentState) { // Belt and braces if (Model_Rack.RackPurpose.OUTPUT == rack) { // Just picked up from output so set current output ID _OutputRack.SetCurrentID(index); } } if (SimulationState.STAGE10_PLACE_VIAL_AT_OUTPUT == _CurrentState) { // Belt and braces if (Model_Rack.RackPurpose.OUTPUT == rack) { _OutputRack.SetCurrentID(index + 1); } } DoProceed(); } RaiseEventOnTopLevel(OnSimulationUpdateEvent, new object[] { this, message }); }