private void ApiKeyInput_OnLostFocus(object sender, RoutedEventArgs e) { var apiKey = this.ApiKeyInput.Text; if (TS3ClientQuery.HasConnectionError) { TS3ClientQuery.ResetConnectionError(); TS3ClientQuery.SetApiKey(apiKey); } Configuration.ApiKey = apiKey; this.ApiKeyInput.Text = Configuration.ApiKey; }
private void Initialize() { if (this.m_isInitialzed) { return; } this.m_isInitialzed = true; this.m_textBuffer = new BlockingTextBuffer(200); this.ApiKeyInput.Text = Configuration.ApiKey; this.OutputTs3StatusMessage("Initializing Ts3 Service..."); TS3ClientQuery.SetApiKey(Configuration.ApiKey); TS3ClientQuery.OnStatusMessageUpdate += this.OutputTs3StatusMessage; TS3ClientQuery.StartQueryClientAsync(); foreach (var name in SpeechUtil.GetPlaybackDeviceNames()) { this.PlaybackDevice.Items.Add(name); if (this.m_selectedDevice == null) { this.m_selectedDevice = name; } } if (this.PlaybackDevice.Items.Count != 0) { this.PlaybackDevice.SelectedIndex = 0; } foreach (var name in SpeechUtil.GetVoiceNames()) { this.PlaybackVoice.Items.Add(name); if (this.m_selectedVoice == null) { this.m_selectedVoice = name; } } if (this.PlaybackVoice.Items.Count != 0) { this.PlaybackVoice.SelectedIndex = 0; } SpeechUtil.Initialize(); }