public async void HandleConnectCommand() { if (IsConnected) { return; } string authKey = Settings.ClientAuthKey; if (Client != null) { Client.CloseClient(); } Client = new TeamspeakClient(Settings.ClientHost, Settings.ClientPort); try { ConnectButtonText = "Connecting..."; await Task.Run(() => { try { Client.ConnectClient(); Client.AuthorizeClient(authKey); Client.ConnectionClosedCallback = OnConnectionClosed; AfterConnectionInit(true); } catch (Exception) { AfterConnectionInit(false); } }); } catch (TeamspeakConnectionException) { AfterConnectionInit(false); } catch (Exception) { AfterConnectionInit(false); } }
/// <summary>Creates the MasterClient with teamspeak information.</summary> /// <param name="ts">The teamspeak information.</param> public MasterClient(TeamspeakClient ts) { tsClient = ts; }