Search in sources :

Example 1 with IEmployeeScreensParameterService

use of EmployeeCommon.IEmployeeScreensParameterService in project SmartCity-Market by TechnionYP5777.

the class EmployeeMainScreen method initialize.

@Override
public void initialize(URL location, ResourceBundle __) {
    AbstractApplicationScreen.fadeTransition(mainScreenPane);
    IEmployeeScreensParameterService employeeScreensParameterService = InjectionFactory.getInstance(EmployeeScreensParameterService.class);
    if (employeeScreensParameterService.getNotShowMainScreenVideo()) {
        MediaPlayer player = new MediaPlayer(new Media(getClass().getResource("/EmployeeMainScreen/SmartMarketSplash.mp4").toExternalForm()));
        MediaView mediaView = new MediaView(player);
        mediaView.setFitWidth(1600);
        mediaView.setFitHeight(900);
        mediaView.setPreserveRatio(false);
        mainScreenPane.getChildren().add(mediaView);
        player.setMute(true);
        player.setCycleCount(MediaPlayer.INDEFINITE);
        player.play();
    }
    vbox.toFront();
    vbox.setFocusTraversable(true);
}
Also used : Media(javafx.scene.media.Media) IEmployeeScreensParameterService(EmployeeCommon.IEmployeeScreensParameterService) MediaView(javafx.scene.media.MediaView) MediaPlayer(javafx.scene.media.MediaPlayer)

Example 2 with IEmployeeScreensParameterService

use of EmployeeCommon.IEmployeeScreensParameterService in project SmartCity-Market by TechnionYP5777.

the class EmployeeApplicationScreen method start.

@Override
public void start(Stage primaryStage) {
    try {
        stage = primaryStage;
        InjectionFactory.createInjector(new EmployeeDiConfigurator(), new CommonDiConfigurator());
        IEmployeeScreensParameterService employeeScreensParameterService = InjectionFactory.getInstance(EmployeeScreensParameterService.class);
        employeeScreensParameterService.setNotShowMainScreenVideo(show);
        barcodeEventHandler = InjectionFactory.getInstance(BarcodeEventHandler.class);
        barcodeEventHandler.initializeHandler();
        barcodeEventHandler.startListening();
        setScene("/EmployeeMainScreen/EmployeeMainScreen.fxml");
        stage.setTitle("Smart Market Beta");
        stage.setMaximized(true);
        stage.setOnCloseRequest(event -> {
            try {
                IWorker worker = InjectionFactory.getInstance(Worker.class);
                if (worker.isLoggedIn())
                    worker.logout();
                event.consume();
                Platform.exit();
                System.exit(0);
            } catch (SMException e) {
                log.fatal(e);
                log.debug(StackTraceUtil.getStackTrace(e));
                e.showInfoToUser();
                Platform.exit();
                System.exit(0);
            }
        });
        stage.show();
    } catch (Exception e) {
        log.fatal(e);
        log.debug(StackTraceUtil.getStackTrace(e));
    }
}
Also used : BarcodeEventHandler(UtilsImplementations.BarcodeEventHandler) EmployeeDiConfigurator(EmployeeDI.EmployeeDiConfigurator) CommonDiConfigurator(CommonDI.CommonDiConfigurator) IEmployeeScreensParameterService(EmployeeCommon.IEmployeeScreensParameterService) IWorker(EmployeeContracts.IWorker) SMException(SMExceptions.SMException) SMException(SMExceptions.SMException)

Aggregations

IEmployeeScreensParameterService (EmployeeCommon.IEmployeeScreensParameterService)2 CommonDiConfigurator (CommonDI.CommonDiConfigurator)1 IWorker (EmployeeContracts.IWorker)1 EmployeeDiConfigurator (EmployeeDI.EmployeeDiConfigurator)1 SMException (SMExceptions.SMException)1 BarcodeEventHandler (UtilsImplementations.BarcodeEventHandler)1 Media (javafx.scene.media.Media)1 MediaPlayer (javafx.scene.media.MediaPlayer)1 MediaView (javafx.scene.media.MediaView)1