/// <summary> // Raises the System.Windows.Window.Closed event. /// </summary> /// <param name="e">An System.EventArgs that contains the event data.</param> protected override void OnClosed(EventArgs e) { if (null != _micClient) { _micClient.Dispose(); } _FinalResponseEvent.Dispose(); base.OnClosed(e); }
public void OnClosed() { if (null != _micClient) { _micClient.Dispose(); } }
protected virtual void Dispose(bool disposing) { if (disposing) { if (_micRecClient != null) { _micRecClient.EndMicAndRecognition(); _micRecClient.OnMicrophoneStatus -= OnMicrophoneStatus; _micRecClient.OnPartialResponseReceived -= OnPartialResponseReceived; _micRecClient.OnResponseReceived -= OnResponseReceived; _micRecClient.OnConversationError -= OnConversationErrorReceived; _micRecClient.Dispose(); _micRecClient = null; } if (_dataRecClient != null) { _dataRecClient.OnIntent -= OnIntentReceived; _dataRecClient.OnPartialResponseReceived -= OnPartialResponseReceived; _dataRecClient.OnConversationError -= OnConversationErrorReceived; _dataRecClient.OnResponseReceived -= OnResponseReceived; _dataRecClient.Dispose(); _dataRecClient = null; } } }
/// <summary> /// Raises the System.Windows.Window.Closed event. /// </summary> /// <param name="e">An System.EventArgs that contains the event data.</param> protected override void OnClosed(EventArgs e) { _dataClient?.Dispose(); _micClient?.Dispose(); base.OnClosed(e); }
private void Stopbtn_Click(object sender, RoutedEventArgs e) { Dispatcher.Invoke((Action)(() => { try { _FinalResponceEvent.Set(); _microphoneRecognitionClient.EndMicAndRecognition(); _microphoneRecognitionClient.Dispose(); _microphoneRecognitionClient = null; Speakbtn.Content = "Start\nRecording"; Speakbtn.IsEnabled = true; Responsetxt.Background = Brushes.White; Responsetxt.Foreground = Brushes.Black; } catch (Exception e1) { Console.WriteLine(e); } })); // Speakbtn.Content = ""; Speakbtn.IsEnabled = true; Responsetxt.Background = Brushes.White; Responsetxt.Foreground = Brushes.Black; Responsetxt.Text = "hello helpline number there is case of murder in my area send urgent help"; GetSentiments(Responsetxt.Text); // using (System.IO.StreamWriter file = //new System.IO.StreamWriter(@"C:\Users\saksham\Desktop\powerbi.xlsx", true)) // { // file.WriteLine(Responsetxt.Text+"\n"); //} }
private void DestroyMicClient() { if (micClient != null) { //micClient.EndMicAndRecognition(); micClient.Dispose(); micClient = null; } }
private void StopMicrophone() { //end mic if (micClient != null) { micClient.EndMicAndRecognition(); micClient.Dispose(); } }
protected override void OnClosed(EventArgs e) { if (null != micClient) { micClient.Dispose(); } base.OnClosed(e); }
public void Stop() { try { micClient.AudioStop(); micClient.Dispose(); dataClient.AudioStop(); dataClient.Dispose(); } catch { } }
public void StopRecording() { try { FinalResponceEvent.Set(); MicrophoneRecognitionClient.EndMicAndRecognition(); MicrophoneRecognitionClient.Dispose(); MicrophoneRecognitionClient = null; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void OnMicShortPhraseResponseReceivedHandler(object sender, SpeechResponseEventArgs e) { Dispatcher.Invoke((Action)(() => { _FinalResponseEvent.Set(); _microphoneRecognitionClient.EndMicAndRecognition(); _microphoneRecognitionClient.Dispose(); _microphoneRecognitionClient = null; RecordButton.Content = "Iniciar\nGrabacion"; RecordButton.IsEnabled = true; OutputTextbox.Background = Brushes.White; OutputTextbox.Foreground = Brushes.Black; })); }
private void btn_Bitir_Click(object sender, EventArgs e) { txt_Cikti.BeginInvoke((Action)(() => { _FinalResponceEvent.Set(); mikrofonTanimaAlicisi.EndMicAndRecognition(); mikrofonTanimaAlicisi.Dispose(); mikrofonTanimaAlicisi = null; btn_Baslar.Text = "Kayda Başla"; btn_Baslar.Enabled = true; txt_Cikti.BackColor = Color.White; txt_Cikti.ForeColor = Color.Black; } )); }
//통화 종료 버튼 private void btnQuitRecord_Click(object sender, RoutedEventArgs e) { if (microphoneRecognitionClient != null) { currentEvent.EventENDTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); savedEventList.Add(currentEvent); microphoneRecognitionClient.EndMicAndRecognition(); microphoneRecognitionClient.Dispose(); microphoneRecognitionClient = null; toastViewModel.ShowInformation("Hang up the call."); //PrintCurrentEvent(currentEvent); InsertCurrentEvent(currentEvent); //현재 처리 중이었던 사건 저장 및 UI 초기화 ResetEvent(); } }
private void StartButton_Click(object sender, RoutedEventArgs e) { if (IsRecognizing) { StartButton.Content = "Start"; micClient.EndMicAndRecognition(); micClient.Dispose(); micClient = null; } else { StartButton.Content = "Stop"; micClient = SpeechRecognitionServiceFactory.CreateMicrophoneClient(SpeechRecognitionMode.LongDictation, "en-US", ApiKey1.Text); micClient.OnPartialResponseReceived += OnPartialResponseReceivedHandler; micClient.OnResponseReceived += OnMicDictationResponseReceivedHandler; micClient.StartMicAndRecognition(); } IsRecognizing = !IsRecognizing; }
/// <summary> /// Handles the Click event of the RadioButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void RadioButton_Click(object sender, RoutedEventArgs e) { // Reset everything if (_micClient != null) { _micClient.EndMicAndRecognition(); _micClient.Dispose(); _micClient = null; } if (_dataClient != null) { _dataClient.Dispose(); _dataClient = null; } _logText.Text = string.Empty; _startButton.IsEnabled = true; _radioGroup.IsEnabled = true; }
public void Stop_Click() { microphoneRecognitionClient.EndMicAndRecognition(); microphoneRecognitionClient.Dispose(); microphoneRecognitionClient = null; }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { _micClient.EndMicAndRecognition(); _micClient.Dispose(); }
public void Dispose() { client?.Dispose(); }
public void Dispose() { _speechClient.EndMicAndRecognition(); _speechClient.Dispose(); }