Example #1
0
        // "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);
        }
Example #2
0
 // "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;
 }
Example #3
0
        // "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();
            }
        }
Example #4
0
 // "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);
 }