Пример #1
0
        public DialogResult showDialog()
        {
            if (System.IO.File.Exists("settings.server.xml"))
            {
                settingsClass settings = new settingsClass();

                XmlSerializer s = new XmlSerializer(typeof(settingsClass));
                TextReader w = new StreamReader(@"settings.server.xml");
                settings = (settingsClass)s.Deserialize(w);
                w.Close();
                this.txtHost.Text = settings.server;
                this.txtUsername.Text = settings.userid;
                this.txtPassword.Text = settings.password;
                this.txtDB.Text = settings.database;
                this.setProvider(settings.dbtype.ToString());
            }
            //this.comboBox1.SelectedIndex = 1;
            return this.ShowDialog();
        }
Пример #2
0
 private void aoButton2_Click(object sender, EventArgs e)
 {
     if (chkRemember.Checked == true)
     {
         settingsClass settings = new settingsClass();
         settings.server = this.txtHost.Text;
         settings.userid = this.txtUsername.Text;
         settings.password = this.txtPassword.Text;
         settings.dbtype = getProvider();
         settings.database = this.txtDB.Text;
         XmlSerializer s = new XmlSerializer(typeof(settingsClass));
         TextWriter w = new StreamWriter(@"settings.server.xml");
         s.Serialize(w, settings);
         w.Close();
     }
     this.DialogResult = DialogResult.OK;
     this.Hide();
 }