예제 #1
0
파일: user.cs 프로젝트: ingIsaac/Vmail
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            user_c t = constants.getMail(this, comboBox1.Text);

            if (t != null)
            {
                button2.Visible   = true;
                textBox1.Text     = t.server;
                textBox2.Text     = t.port.ToString();
                checkBox1.Checked = t.ssl ? true : false;
                textBox4.Text     = t.user;
                textBox5.Text     = t.password;
            }
        }
예제 #2
0
        public static user_c getMail(Form form, string email)
        {
            user_c t = null;

            try
            {
                XDocument opciones_xml = XDocument.Load(xmlfile);

                var n = opciones_xml.Descendants("Config").Elements("User").Where(x => x.Element("Email").Value == email).FirstOrDefault();

                if (n != null)
                {
                    t = new user_c(n.Element("Server").Value, stringToInt(n.Element("Port").Value), n.Element("Ssl").Value == "true" ? true : false, n.Element("Email").Value, n.Element("Password").Value, null);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(form, "[Error] no se puede obtener datos del archivo config.xml. \n\n" + e.ToString(), msg_box_caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(t);
        }