close btc network warn popup when enough peers again

This commit is contained in:
Manfred Karrer 2016-01-27 18:48:22 +01:00
parent 2af38f70d6
commit cc128ad508
2 changed files with 7 additions and 5 deletions

View file

@ -87,7 +87,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
private Label btcSplashInfo;
private List<String> persistedFilesCorrupted;
private static BorderPane baseApplicationContainer;
private Popup p2PNetworkWarnMsgPopup;
private Popup p2PNetworkWarnMsgPopup, btcNetworkWarnMsgPopup;
@Inject
public MainView(MainViewModel model, CachingViewLoader viewLoader, Navigation navigation, Transitions transitions,
@ -351,10 +351,11 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
model.walletServiceErrorMsg.addListener((ov, oldValue, newValue) -> {
if (newValue != null) {
btcInfoLabel.setId("splash-error-state-msg");
new Popup().warning(newValue + "\nPlease check your internet connection or try to restart the application.")
.show();
btcNetworkWarnMsgPopup = new Popup().warning(newValue).show();
} else {
btcInfoLabel.setId("footer-pane");
if (p2PNetworkWarnMsgPopup != null)
p2PNetworkWarnMsgPopup.hide();
}
});

View file

@ -270,11 +270,12 @@ public class MainViewModel implements ViewModel {
if (numberofBtcPeersTimer != null)
numberofBtcPeersTimer.cancel();
numberofBtcPeersTimer = UserThread.runAfter(() -> {
if (walletService.numPeersProperty().get() == 0)
if (walletService.numPeersProperty().get() == 0) {
walletServiceErrorMsg.set("You lost the connection to all bitcoin network peers.\n" +
"Maybe you lost your internet connection or your computer was in hibernate/sleep mode.");
else
} else {
walletServiceErrorMsg.set(null);
}
}, 5);
} else if ((int) oldValue == 0 && (int) newValue > 0) {
walletServiceErrorMsg.set(null);