private void ConfigureForm_Load(object sender, EventArgs e) { ConnectionSettings connectionSettings = new ConnectionSettings(); connectionSettings.LoadFromRegistry(); textBoxAPIURL.Text = connectionSettings.URL; textBoxUsername.Text = connectionSettings.Username; textBoxPassword.Text = connectionSettings.Password; ProjectData project = new ProjectData(); project.name = connectionSettings.ProjectName; project.id = connectionSettings.ProjectID; listBoxProject.Items.Add(project); listBoxProject.SelectedIndex = 0; }
private void buttonOK_Click(object sender, EventArgs e) { ProjectData selectedProject = (ProjectData)listBoxProject.SelectedItem; ConnectionSettings connectionSettings = new ConnectionSettings(); if (selectedProject != null) { connectionSettings.ProjectID = selectedProject.id; connectionSettings.ProjectName = selectedProject.name; } connectionSettings.URL = textBoxAPIURL.Text; connectionSettings.Username = textBoxUsername.Text; connectionSettings.Password = textBoxPassword.Text; connectionSettings.SaveToRegistry(); DialogResult = ((Button)sender).DialogResult; Close(); }