// "Record" button(Inside of the NewMail Window) functions private void StopNewMail_Button_Click(object sender, RoutedEventArgs e) { NewMail_RichTextBox.AppendText(" "); speechRecNewMail.RecognizeAsyncStop(); RecordNewMail_Button.IsEnabled = true; StopNewMail_Button.IsEnabled = false; }
// "Send" button(Inside of the NewMail Window) functions private void Send_Button_Click_1(object sender, RoutedEventArgs e) { if (!String.IsNullOrEmpty(To_TextBox.Text)) { //Create new "Mail" object and store it in proper Lists Mail newmail = new Mail(); string myText; NewMail_RichTextBox.SelectAll(); if (NewMail_RichTextBox.Selection.Text.Length > 30) { myText = new TextRange(NewMail_RichTextBox.Document.ContentStart, NewMail_RichTextBox.Document.ContentStart.GetPositionAtOffset(30)).Text; } else { myText = new TextRange(NewMail_RichTextBox.Document.ContentStart, NewMail_RichTextBox.Document.ContentEnd).Text; } newmail.Title = Subject_TextBox.Text + ": " + myText + "..."; newmail.Date = DateTime.UtcNow.ToString(); NewMail_RichTextBox.SelectAll(); newmail.Content = NewMail_RichTextBox.Selection.Text; //Adding to Sentlist SentList.Items.Add(newmail); //Adding to ReceivedList ReceivedList.Items.Add(newmail); NewMail_GroupBox.Visibility = Visibility.Hidden; } else { MessageBox.Show("Please enter email address!"); } NewMail_RichTextBox.AppendText(To_TextBox.Text); }
//Adding recored text to the "NewMail_RichTextBox" after clicking "Record" Button (Inside of the NewMail Window) void SpeechRecNewMail_SpeechRecognized(object sender, SpeechRecognizedEventArgs e) { NewMail_RichTextBox.AppendText(e.Result.Text); }