April 2018
Intermediate to advanced
910 pages
33h 21m
English
Up until this point, everything has assumed that the desktop is already connected to the phone. We have enough pieces in place now that we can talk about that in a meaningful manner.
In the application's main Menu, we have two MenuItems: Connect to Phone and Disconnect from Phone. The Connect to Phone handler looks as follows:
@FXML
protected void connectToPhone(ActionEvent event) {
ConnectToPhoneController.showAndWait();
if (!preferences.getToken().isEmpty()) {
refreshAndListen();
}
}
We're going to use the now-familiar showAndWait() pattern to display a modal dialog, and to get the response using the new ConnectToPhoneController. The user interface is very simple, and is shown in this screenshot:
When the user ...