Пример #1
0
        /// <summary>
        /// Show info about selected email
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            try {
                using (var objProvider = new MailProvider()) {
                    var   objTempEmail = (Email)listBox1.SelectedItem;
                    Email objEmail     = objProvider.GetEmailById(objTempEmail.Id);
                    if (objEmail == null)
                    {
                        return;
                    }

                    textBox10.Text    = objEmail.SendingTime.ToString("dd-MM-yyyy ddd HH:mm");
                    richTextBox3.Text = objEmail.Text;
                    textBox9.Text     = objEmail.Header;
                    if (objEmail.Sended)
                    {
                        label18.ForeColor = Color.DarkGreen;
                        label18.Text      = "Sended";
                    }
                    else
                    {
                        label18.ForeColor = Color.DarkOrange;
                        label18.Text      = "Awaits for sending";
                    }
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        /// <summary>
        /// Update current Email info
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button6_Click(object sender, EventArgs e)
        {
            try {
                using (var objProvider = new MailProvider()) {
                    var objTempEmail = (Email)listBox1.SelectedItem;

                    Email objEmail = objProvider.GetEmailById(objTempEmail.Id);
                    if (objEmail == null)
                    {
                        throw new ArgumentNullException("Cant find email with Id=" + objTempEmail.Id);
                    }
                    objEmail.Text   = richTextBox3.Text;
                    objEmail.Header = textBox9.Text;
                }
                UpdateListBox1();
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }