Examples of NetworkControl


Examples of com.art.anette.client.network.NetworkControl

        }

        // 8) Set the timezone
        Main.adjustTimezone(logger);

        final NetworkControl network = NetworkControl.getInstance();
        NetworkListener listener = new NetworkListener() {
            public void statusChange(NetworkEvent event) {
                logger.info("network event " + event);
            }
        };
        network.addListener(listener);
        try {
            network.initSSL();
        } catch (SSLException ex) {
            logger.severe("SSL Failure", ex);
            ProgressUtils.errorMessage("SSLFailed");
            throw new Exception("SSL-problem");
        }

        final BasicController basicControl = BasicController.getInstance();

        // nicht registriert oder eingeloggt
        assert !("".equals(config.getProperty("user.email")) || "".equals(config.getProperty("user.password")));

        try {
            final ProgressUtils.Monitor monitor = ProgressUtils.createProgress(lang.getString("ProgressLoggingIn"));
            basicControl.login(new LoginRequest(config.getProperty("user.email"), config.getProperty("user.password")));
            monitor.finish();
        } catch (NetworkException ex) {
            logger.severe("Connection Failure", ex);
            return;
        } catch (LoginFailedException ex) {
            logger.severe("Login Failure", ex);
            return;
        }

        // nun eingeloggt; starte Hauptfenster
        assert basicControl.isLoggedIn();

        final Logic logic;
        try {
            logic = Logic.getInstance(config, basicControl.getLoggedInEmployee());
        } catch (LogicInitFailedException e) {
            logger.severe("Can't create logic");
            return;
        }
        network.setLoginData(basicControl.getLoginData(), logic.getDBControl());
        network.start();
        ClientConfiguration.getInstance().setProperty("db.dirty", "true");
        ClientConfiguration.getInstance().writeConfiguration();

        if (sleepTime == 0) {
            doOneShot(logic);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.