TransferBot/src/main/java/it/cavallium/SecondaryController.java

25 lines
698 B
Java
Raw Permalink Normal View History

package it.cavallium;
import java.io.IOException;
2020-10-20 02:54:32 +02:00
import java.time.Duration;
import javafx.fxml.FXML;
2020-10-20 02:54:32 +02:00
import javafx.scene.control.Button;
import javafx.scene.control.Spinner;
public class SecondaryController {
2020-10-20 02:54:32 +02:00
public Button closeButton;
public Spinner<Integer> delaySeconds;
@FXML
protected void initialize() {
delaySeconds.getValueFactory().setValue((int) App.getSettingsService().getDelayBetweenAdds().toSeconds());
}
2020-10-20 00:31:11 +02:00
@FXML
private void switchToPrimary() throws IOException {
2020-10-20 02:54:32 +02:00
var delaySecondsValue = Duration.ofSeconds(Math.max (0, (int) delaySeconds.getValueFactory().getValue()));
App.getSettingsService().setDelayBetweenAdds(delaySecondsValue);
2020-10-20 00:31:11 +02:00
App.setRoot("primary");
}
}