Commit 6f527d70 authored by Xuhao Lin's avatar Xuhao Lin
Browse files

[IHM-MAIN] better exit action, now all exit action call signout before exiting

parent 1ce78095
......@@ -5,6 +5,7 @@
*/
package com.utclo23.ihmmain;
import com.utclo23.data.module.DataException;
import com.utclo23.ihmmain.constants.SceneName;
import com.utclo23.ihmmain.controller.AbstractController;
import com.utclo23.ihmmain.controller.PlayerProfileController;
......@@ -65,11 +66,11 @@ public class IHMMain {
} catch (FileNotFoundException ex) {
Logger.getLogger(PlayerListController.class.getName()).log(Level.SEVERE, null, ex);
}
//add onClose event handler which handle the event when user clicks X
//add onClose event handler which handle the event when user clics X
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent we) {
System.exit(0);
exit();
}
});
}
......@@ -176,4 +177,14 @@ public class IHMMain {
return scene;
}
public void exit(){
try{
facade.iDataIHMMain.signOut();
System.out.println("Logged out");
}catch (Exception e) {
//not displaying anything, the app is closing
}
System.exit(0);
}
}
......@@ -64,7 +64,7 @@ public class LoginController extends AbstractController{
*/
@FXML
private void exitAction(ActionEvent event){
System.exit(0);
getIhmmain().exit();
}
/**
......
......@@ -61,7 +61,7 @@ public class MenuController extends AbstractController{
@FXML
private void exit(ActionEvent event){
System.exit(0);
getIhmmain().exit();
}
@FXML
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment