// "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); }
// "NewMail" button functions private void NewMail_Button_Click(object sender, RoutedEventArgs e) { To_TextBox.Text = ""; Subject_TextBox.Text = ""; NewMail_RichTextBox.SelectAll(); NewMail_RichTextBox.Selection.Text = ""; NewMail_GroupBox.Visibility = Visibility.Visible; }
// "Close" button(Inside of the NewMail Window) functions private void CloseNewMail_Button_Click(object sender, RoutedEventArgs e) { NewMail_GroupBox.Visibility = Visibility.Hidden; //Delete new mail contents To_TextBox.Text = ""; Subject_TextBox.Text = ""; NewMail_RichTextBox.SelectAll(); NewMail_RichTextBox.Selection.Text = ""; //Click stop recording new mail while close new mail button is pressed if (StopNewMail_Button.IsEnabled) { ButtonAutomationPeer peerStopNewMail = new ButtonAutomationPeer(StopNewMail_Button); IInvokeProvider invokeProvNewMail = peerStopNewMail.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProvNewMail.Invoke(); } }
// "Listen" button(Inside of the NewMail Window) functions private void ListenNewMail_Button_Click(object sender, RoutedEventArgs e) { // Speak a string. NewMail_RichTextBox.SelectAll(); synthNewMail.Speak(NewMail_RichTextBox.Selection.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); }