/**
 * 
 */
package org.josast.EntrysatDecoder;


import java.io.File;
import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Logger;

/**
 * @author christophe
 *
 */
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene; 
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage; 
  
public class Main extends Application { 
	
	Logger logger = Logger.getLogger("EntrySatLogger");
  
    @Override 
    public void init() throws Exception { 
        super.init();  
        
        
        
        
    } 
  
    @Override 
    public void start(Stage primaryStage)throws Exception {          

    	try {
        	String path = System.getProperty("user.dir")+"/log";
    		File apath = new File(path);
    		
    		if (!apath.exists())
    		{
    			if (apath.mkdir() == false)
    			{
    				System.err.println("fail to create "+ path);
    			}
    		}
        	FileHandler fh=new FileHandler(path+"/"+"EntrySatLog.txt");

        	logger.addHandler(fh);

        	} catch (SecurityException e) {

        	e.printStackTrace();

        	} catch (IOException e) {

        	e.printStackTrace();

        	}
    	 //---Chargement du fichier FXML
    	System.setProperty("glass.accessible.force", "false");
    	FXMLLoader loader= new FXMLLoader(getClass().getResource("EntrsatDecoder.fxml"));
    	BorderPane root= loader.load();
     	Controler ctrl = loader.getController();
     	ctrl.setPrimaryStage(primaryStage);
    	Scene scene= new Scene(root);
    	scene.getStylesheets().add("/BasicApplication.css");
    	primaryStage.setScene(scene);
    	primaryStage.setTitle("Entry Sat Decoder");
    	ctrl.initMMI();
    
    	primaryStage.show();
    } 
    

    public static void main(String[] args) { 

        launch(args); 
    }     
}
