private void UpdateConnectionStatus(ConnectEvent connectEvent) { if (connectEvent.IsSuccess) { connectionStatusText.text = TranslationManager.GetTranslation(R.Messages.connectedTo, "remote", connectEvent.ServerIpEndPoint.Address); uiDoc.rootVisualElement.Query(null, "onlyVisibleWhenConnected").ForEach(it => it.Show()); audioWaveForm.SetVisible(settings.ShowAudioWaveForm); connectionThroubleshootingText.Hide(); serverErrorResponseText.Hide(); toggleRecordingButton.Focus(); UpdateRecordingDeviceButtons(); } else { connectionStatusText.text = connectEvent.ConnectRequestCount > 0 ? TranslationManager.GetTranslation(R.Messages.connectingWithFailedAttempts, "count", connectEvent.ConnectRequestCount) : TranslationManager.GetTranslation(R.Messages.connecting); uiDoc.rootVisualElement.Query(null, "onlyVisibleWhenConnected").ForEach(it => it.Hide()); if (connectEvent.ConnectRequestCount > ConnectRequestCountShowTroubleshootingHintThreshold) { connectionThroubleshootingText.Show(); connectionThroubleshootingText.text = TranslationManager.GetTranslation(R.Messages.troubleShootingHints); } if (!connectEvent.ErrorMessage.IsNullOrEmpty()) { serverErrorResponseText.Show(); serverErrorResponseText.text = connectEvent.ErrorMessage; } } }
private void UpdateConnectionStatus(ConnectEvent connectEvent) { if (connectEvent.IsSuccess) { connectionStatusText.text = TranslationManager.GetTranslation(R.Messages.companionApp_connectedTo, "remote", connectEvent.ServerIpEndPoint.Address); onlyVisibleWhenConnected.ForEach(it => it.ShowByDisplay()); onlyVisibleWhenNotConnected.ForEach(it => it.HideByDisplay()); audioWaveForm.SetVisibleByDisplay(settings.ShowAudioWaveForm); connectionThroubleshootingText.HideByDisplay(); serverErrorResponseText.HideByDisplay(); toggleRecordingButton.Focus(); connectionInfoText.text = $"Connected to {connectEvent.ServerIpEndPoint.Address}:{connectEvent.ServerIpEndPoint.Port}"; } else { connectionInfoText.text = "Not connected"; connectionStatusText.text = connectEvent.ConnectRequestCount > 0 ? TranslationManager.GetTranslation(R.Messages.companionApp_connectingWithFailedAttempts, "count", connectEvent.ConnectRequestCount) : TranslationManager.GetTranslation(R.Messages.companionApp_connecting); onlyVisibleWhenConnected.ForEach(it => it.HideByDisplay()); onlyVisibleWhenNotConnected.ForEach(it => it.ShowByDisplay()); if (connectEvent.ConnectRequestCount > ConnectRequestCountShowTroubleshootingHintThreshold) { connectionThroubleshootingText.ShowByDisplay(); connectionThroubleshootingText.text = TranslationManager.GetTranslation(R.Messages.companionApp_troubleShootingHints); } if (!connectEvent.ErrorMessage.IsNullOrEmpty()) { serverErrorResponseText.ShowByDisplay(); serverErrorResponseText.text = connectEvent.ErrorMessage; } } }