/// <summary> /// Starts the relay engine. /// </summary> private void StartRelayEngine() { Thread backGroundThread = new Thread(new ThreadStart(() => { try { TunnelRelayStateManager.InitializePlugins(); TunnelRelayStateManager.RelayRequestEventListener = this; TunnelRelayStateManager.StartTunnelRelayAsync().ConfigureAwait(false).GetAwaiter().GetResult(); this.Dispatcher.Invoke(new Action(() => { this.txtProxyDetails.Text = TunnelRelayStateManager.ApplicationData.HybridConnectionUrl + TunnelRelayStateManager.ApplicationData.HybridConnectionName; this.btnExportSettings.IsEnabled = true; })); } catch (Exception ex) { this.logger.LogError(ex, "Failed to establish connection to Azure Relay"); this.Dispatcher.Invoke(new Action(() => { this.txtProxyDetails.Text = "FAILED TO START AZURE PROXY!!!!"; this.btnExportSettings.IsEnabled = false; })); } })); backGroundThread.Start(); }