Example #1
0
        private void btnServidorEditar_Click(object sender, EventArgs e)
        {
            if (lstServidores.SelectedItems.Count == 1)
            {
                frmServerData frmServerData = new frmServerData();

                SmtpConfig serverConfig = new SmtpConfig();
                serverConfig = (SmtpConfig)lstServidores.SelectedItems[0].Tag;

                frmServerData.PutData(serverConfig);

                if (frmServerData.ShowDialog(this) == DialogResult.OK)
                {
                    lstServidores.SelectedItems[0].Text             = frmServerData.serverConfig.ProveedorNombre;
                    lstServidores.SelectedItems[0].SubItems[1].Text = frmServerData.serverConfig.Email;
                    lstServidores.SelectedItems[0].SubItems[2].Text = frmServerData.serverConfig.SmtpHost;
                    lstServidores.SelectedItems[0].SubItems[3].Text = frmServerData.serverConfig.Puerto.ToString();
                    lstServidores.SelectedItems[0].SubItems[4].Text = frmServerData.serverConfig.SSL ? "SI" : "NO";
                    lstServidores.SelectedItems[0].Tag = frmServerData.serverConfig;

                    GuardarServidores();
                }
            }
            else
            {
                MessageBox.Show("Debe seleccionar un servidor primero", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Example #2
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            frmServerData frmServerData = new frmServerData();

            frmServerData.ResetServerForm();
            if (frmServerData.ShowDialog(this) == DialogResult.OK)
            {
                ListViewItem itm = new ListViewItem();
                itm.Text = frmServerData.serverConfig.ProveedorNombre;
                itm.SubItems.Add(frmServerData.serverConfig.Email);
                itm.SubItems.Add(frmServerData.serverConfig.SmtpHost);
                itm.SubItems.Add(frmServerData.serverConfig.Puerto.ToString());
                itm.SubItems.Add(frmServerData.serverConfig.SSL ? "SI" : "NO");
                itm.Tag = frmServerData.serverConfig;


                lstServidores.Items.Add(itm);
                state.AddServer(frmServerData.serverConfig);
                GuardarServidores();
            }
        }