Search in sources :

Example 1 with BarcodeEventHandler

use of UtilsImplementations.BarcodeEventHandler in project SmartCity-Market by TechnionYP5777.

the class CustomerApplicationScreen method start.

@Override
public void start(Stage primaryStage) {
    try {
        stage = primaryStage;
        InjectionFactory.createInjector(new CustomerDiConfigurator());
        barcodeEventHandler = InjectionFactory.getInstance(BarcodeEventHandler.class);
        barcodeEventHandler.initializeHandler();
        barcodeEventHandler.startListening();
        setScene("/CustomerWelcomeScreen/CustomerWelcomeScreen.fxml");
        stage.setTitle("Smart Market Beta");
        stage.setMaximized(true);
        stage.setOnCloseRequest(event -> {
            try {
                ICustomer customer = InjectionFactory.getInstance(Customer.class);
                customer.logout();
                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 ยข) {
        throw new RuntimeException();
    }
}
Also used : BarcodeEventHandler(UtilsImplementations.BarcodeEventHandler) CustomerDiConfigurator(CustomerDI.CustomerDiConfigurator) ICustomer(CustomerContracts.ICustomer) SMException(SMExceptions.SMException) SMException(SMExceptions.SMException)

Example 2 with BarcodeEventHandler

use of UtilsImplementations.BarcodeEventHandler 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

SMException (SMExceptions.SMException)2 BarcodeEventHandler (UtilsImplementations.BarcodeEventHandler)2 CommonDiConfigurator (CommonDI.CommonDiConfigurator)1 ICustomer (CustomerContracts.ICustomer)1 CustomerDiConfigurator (CustomerDI.CustomerDiConfigurator)1 IEmployeeScreensParameterService (EmployeeCommon.IEmployeeScreensParameterService)1 IWorker (EmployeeContracts.IWorker)1 EmployeeDiConfigurator (EmployeeDI.EmployeeDiConfigurator)1