package com.github.athi.athifx.gui.application;

import com.github.athi.athifx.gui.configuration.AthiFXApplicationProperties;
import com.github.athi.athifx.gui.navigation.navigator.NavigationPane;
import com.github.athi.athifx.injector.injection.AthiFXInjector;
import com.google.common.io.Resources;
import com.google.inject.Inject;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.image.Image;
import javafx.scene.text.Font;
import javafx.stage.Stage;

import java.net.URL;

/**
 * Created by Athi
 */
public class AthiFXApplication extends Application {

    @Inject
    private AthiFXApplicationProperties applicationConfiguration;

    @Inject
    private NavigationPane navigationPane;

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        LoadingScreen.show(primaryStage);

        new Thread(() -> {
            AthiFXInjector.createInjector(this);
            Platform.runLater(() -> {
                closeScreenIfShowing(primaryStage);
                MainScreen.show(primaryStage, navigationPane);
                navigationPane.setViewAsContent(applicationConfiguration.getViews().get(1L));
            });
        }).start();
    }

    private void closeScreenIfShowing(Stage primaryStage) {
        if (primaryStage.isShowing()) {
            primaryStage.close();
        }
    }
}

@@ -908,31 +908,19 @@
 en.show(
-primaryStage
 );%0A
+
 %0A       
@@ -1046,41 +1046,28 @@
     
-closeScreenIfShowing(primaryStage
+LoadingScreen.close(
 );%0A 
@@ -1238,16 +1238,16 @@
     %7D);%0A
+
         
@@ -1267,158 +1267,7 @@
    %7D
-%0A%0A    private void closeScreenIfShowing(Stage primaryStage) %7B%0A        if (primaryStage.isShowing()) %7B%0A            primaryStage.close();%0A        %7D%0A    %7D
 %0A%7D%0A

Update AthiFXApplication.java