use of EmployeeDI.EmployeeDiConfigurator 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));
}
}
Aggregations