private void ConnectionRetry() { HubConnection.Stop(new TimeSpan(0, 0, 0, 1)); IPopupController popup = CustomContainer.Get <IPopupController>(); var application = Application.Current; MessageBoxResult res = MessageBoxResult.No; if (application != null && application.Dispatcher != null) { application.Dispatcher.Invoke(() => { res = popup.ShowConnectionTimeoutConfirmation(DisplayName); }); } if (res == MessageBoxResult.Yes) { if (!HubConnection.Start().Wait(5000)) { ConnectionRetry(); } } else { throw new NotConnectedException(); } }