Search in sources :

Example 1 with ExamController

use of com.cas.sim.tis.view.controller.ExamController in project TeachingInSimulation by ScOrPiOzzy.

the class ExamMessageHandler method execute.

@Override
public void execute(Client client, ExamMessage m) throws Exception {
    int type = m.getType();
    if (ExamMessage.EXAM_START == type) {
        LibraryPublish publish = SpringUtil.getBean(LibraryPublishAction.class).findPublishById(m.getPid());
        Platform.runLater(() -> {
            Application.showView(ExamView.class);
            ExamController controller = SpringUtil.getBean(ExamController.class);
            controller.initialize(publish);
        });
    } else if (ExamMessage.EXAM_OVER == type) {
        Platform.runLater(() -> {
            ExamController controller = SpringUtil.getBean(ExamController.class);
            if (m.getPid() == controller.getLibraryPublish().getId()) {
                controller.submit(true);
            }
        });
    }
}
Also used : LibraryPublishAction(com.cas.sim.tis.action.LibraryPublishAction) ExamController(com.cas.sim.tis.view.controller.ExamController) LibraryPublish(com.cas.sim.tis.entity.LibraryPublish)

Example 2 with ExamController

use of com.cas.sim.tis.view.controller.ExamController in project TeachingInSimulation by ScOrPiOzzy.

the class PreviewQuestionPaper method practice.

@FXML
private void practice() {
    int id = SpringUtil.getBean(LibraryPublishAction.class).practiceLibraryByStudent(rid);
    LibraryPublish publish = SpringUtil.getBean(LibraryPublishAction.class).findPublishById(id);
    Application.showView(ExamView.class);
    ExamController controller = SpringUtil.getBean(ExamController.class);
    controller.initialize(publish);
}
Also used : LibraryPublishAction(com.cas.sim.tis.action.LibraryPublishAction) ExamController(com.cas.sim.tis.view.controller.ExamController) LibraryPublish(com.cas.sim.tis.entity.LibraryPublish) FXML(javafx.fxml.FXML)

Aggregations

LibraryPublishAction (com.cas.sim.tis.action.LibraryPublishAction)2 LibraryPublish (com.cas.sim.tis.entity.LibraryPublish)2 ExamController (com.cas.sim.tis.view.controller.ExamController)2 FXML (javafx.fxml.FXML)1