Пример #1
0
        public void 邮箱AddItemEvent(object sender, EventArgs e)
        {
            EmailHelper.EmailConfig ec = emailList.SingleOrDefault(m => m.Value == ((ToolStripItem)sender).Name).Key;
            EmailMessageResult      emailMessageResult = new EmailMessageResult(ec);

            emailMessageResult.Show();
        }
Пример #2
0
 private void ListBox1_DoubleClick(object sender, EventArgs e)
 {
     if (listBox1.SelectedItem == null)
     {
         return;
     }
     else
     {
         EmailHelper.EmailConfig ec = JsonConvert.DeserializeObject <EmailHelper.EmailConfig>(listBox1.SelectedItem.ToString());
         AddEmail ae = new AddEmail(ec);
         ae.ShowDialog();
         list = EmailHelper.EmailHelper.GetConfigsFormConfig();
         listBox1.Items.Clear();
         foreach (var eeec in list)
         {
             listBox1.Items.Add(eeec.ToString());
         }
     }
 }
Пример #3
0
 public AddEmail(EmailHelper.EmailConfig ec)
 {
     InitializeComponent();
     Text              = "修改邮箱配置";
     textBox1.Text     = ec.Url;
     textBox2.Text     = ec.Port.ToString();
     textBox3.Text     = ec.UserName;
     textBox4.Text     = ec.PassWrod;
     checkBox1.Checked = ec.SSl;
     if (ec.EmailType == EmailHelper.EmailType.IMAP)
     {
         radioButton1.Checked = true;
     }
     else
     {
         radioButton2.Checked = true;
     }
     IsChange = true;
     ecbak    = ec;
 }
Пример #4
0
        private void Button1_Click(object sender, EventArgs e)
        {
            string server   = textBox1.Text;
            string port     = textBox2.Text;
            string username = textBox3.Text;
            string password = textBox4.Text;
            bool   isTSL    = checkBox1.Checked;

            EmailHelper.EmailType et = radioButton1.Checked ? EmailHelper.EmailType.IMAP : EmailHelper.EmailType.POP3;
            try
            {
                EmailHelper.EmailHelper eh = new EmailHelper.EmailHelper(server, int.Parse(port), username, password, isTSL, et);
                int count = eh.GetEmailCount();
                if (!IsChange)
                {
                    eh.SaveConfToFile();
                }
                else
                {
                    EmailHelper.EmailConfig ecc = new EmailHelper.EmailConfig
                    {
                        Url       = server,
                        UserName  = username,
                        PassWrod  = password,
                        SSl       = isTSL,
                        Port      = int.Parse(port),
                        EmailType = et
                    };
                    eh.ChangeOneConfig(ecbak, ecc);
                }
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK);
            }
        }