mirror of
https://github.com/developersu/ns-usbloader.git
synced 2025-05-13 06:34:43 -04:00
Initial commit
This commit is contained in:
commit
c21417c043
20 changed files with 1904 additions and 0 deletions
72
src/main/java/nsusbloader/NSLMain.java
Normal file
72
src/main/java/nsusbloader/NSLMain.java
Normal file
|
@ -0,0 +1,72 @@
|
|||
/**
|
||||
Name: NSL-USBFoil
|
||||
@author Dmitry Isaenko
|
||||
License: GNU GPL v.3
|
||||
@see https://github.com/developersu/
|
||||
2019, Russia
|
||||
*/
|
||||
package nsusbloader;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class NSLMain extends Application {
|
||||
static final String appVersion = "v0.1-DEVELOPMENT";
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception{
|
||||
ResourceBundle rb;
|
||||
if (Locale.getDefault().getISO3Language().equals("rus"))
|
||||
rb = ResourceBundle.getBundle("locale", new Locale("ru"));
|
||||
else
|
||||
rb = ResourceBundle.getBundle("locale", new Locale("en"));
|
||||
|
||||
// If it's windows, refuse to work
|
||||
if (System.getProperty("os.name").toLowerCase().startsWith("win")){
|
||||
ServiceWindow.getErrorNotification(rb.getString("windowErrorHeader"), rb.getString("windowItsWindowsMessage"));
|
||||
}
|
||||
else{
|
||||
// If it's not, go ahead
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/NSLMain.fxml"));
|
||||
|
||||
loader.setResources(rb);
|
||||
Parent root = loader.load();
|
||||
|
||||
primaryStage.getIcons().addAll(
|
||||
new Image(getClass().getResourceAsStream("/res/app_icon32x32.png")),
|
||||
new Image(getClass().getResourceAsStream("/res/app_icon48x48.png")),
|
||||
new Image(getClass().getResourceAsStream("/res/app_icon64x64.png")),
|
||||
new Image(getClass().getResourceAsStream("/res/app_icon128x128.png"))
|
||||
);
|
||||
|
||||
primaryStage.setTitle("NS-USBloader");
|
||||
primaryStage.setMinWidth(600);
|
||||
primaryStage.setMinHeight(375);
|
||||
Scene mainScene = new Scene(root, 800, 400);
|
||||
mainScene.getStylesheets().add("/res/app.css");
|
||||
primaryStage.setScene(mainScene);
|
||||
primaryStage.show();
|
||||
|
||||
primaryStage.setOnCloseRequest(e->{
|
||||
if (MediatorControl.getInstance().getTransferActive())
|
||||
if(! ServiceWindow.getConfirmationWindow(rb.getString("windowTitleConfirmExit"), rb.getString("windowBodyConfirmExit")))
|
||||
e.consume();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
if ((args.length == 1) && (args[0].equals("-v") || args[0].equals("--version"))){
|
||||
System.out.println(NSLMain.appVersion);
|
||||
}
|
||||
else
|
||||
launch(args);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue