コード例 #1
0
        public bool showDialog(string title, ref MsSmtpConfig smtpConfig)
        {
            bool result = false;

            this.Text = title;

            txtName.Text = smtpConfig.Name;
            txtHost.Text = smtpConfig.Host;
            txtUsername.Text = smtpConfig.Username;
            txtPassword.Text = smtpConfig.Password;
            txtPort.Text = smtpConfig.Port.ToString();
            chkEnableSSL.Checked = smtpConfig.EnableSsl;

            if (this.ShowDialog() == DialogResult.OK)
            {
                smtpConfig.Name = txtName.Text;
                smtpConfig.Host = txtHost.Text;
                smtpConfig.Username = txtUsername.Text;
                smtpConfig.Password = txtPassword.Text;
                smtpConfig.Port = MsConversion.StringToInt(txtPort.Text, 25);
                smtpConfig.EnableSsl = chkEnableSSL.Checked;

                result = true;
            }

            return result;
        }
コード例 #2
0
ファイル: frmTestApp.cs プロジェクト: pdesterlich/msUtilities
 private void button1_Click(object sender, EventArgs e)
 {
     var smtpConfigForm = new msSmtpConfigForm();
     var smtpConfig = new MsSmtpConfig();
     if (smtpConfigForm.showDialog("msUtilities Test App", ref smtpConfig))
     {
         MessageBox.Show(smtpConfig.Name);
         MessageBox.Show(smtpConfig.Host);
     }
 }