1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.ComponentModel;
|
---|
4 | using System.Drawing;
|
---|
5 | using System.Data;
|
---|
6 | using System.Linq;
|
---|
7 | using System.Text;
|
---|
8 | using System.Windows.Forms;
|
---|
9 |
|
---|
10 | namespace HeuristicLab.PluginInfrastructure.Advanced {
|
---|
11 | internal partial class ConnectionSetupView : InstallationManagerControl {
|
---|
12 | private Form form;
|
---|
13 | public ConnectionSetupView() {
|
---|
14 | InitializeComponent();
|
---|
15 |
|
---|
16 | urlTextBox.Text = HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocation;
|
---|
17 | userTextBox.Text = HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationUserName;
|
---|
18 | passwordTextBox.Text = HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationPassword;
|
---|
19 | savePasswordCheckbox.Checked = !string.IsNullOrEmpty(passwordTextBox.Text);
|
---|
20 | }
|
---|
21 |
|
---|
22 | private void applyButton_Click(object sender, EventArgs e) {
|
---|
23 | HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocation = urlTextBox.Text;
|
---|
24 | if (!savePasswordCheckbox.Checked) {
|
---|
25 | // make sure we don't save username or password
|
---|
26 | HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationUserName = string.Empty;
|
---|
27 | HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationPassword = string.Empty;
|
---|
28 | // save
|
---|
29 | HeuristicLab.PluginInfrastructure.Properties.Settings.Default.Save();
|
---|
30 | // set user name and password for current process
|
---|
31 | HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationUserName = userTextBox.Text;
|
---|
32 | HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationPassword = passwordTextBox.Text;
|
---|
33 | } else {
|
---|
34 | HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationUserName = userTextBox.Text;
|
---|
35 | HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationPassword = passwordTextBox.Text;
|
---|
36 | HeuristicLab.PluginInfrastructure.Properties.Settings.Default.Save();
|
---|
37 | }
|
---|
38 | form.Close();
|
---|
39 | }
|
---|
40 |
|
---|
41 | private void cancelButton_Click(object sender, EventArgs e) {
|
---|
42 | form.Close();
|
---|
43 | }
|
---|
44 |
|
---|
45 | internal override void ShowInForm() {
|
---|
46 | if (this.form == null) {
|
---|
47 | form = new Form();
|
---|
48 | form.Name = this.Name;
|
---|
49 | this.Dock = DockStyle.Fill;
|
---|
50 | form.Controls.Add(this);
|
---|
51 | }
|
---|
52 | form.Show();
|
---|
53 | }
|
---|
54 | }
|
---|
55 | }
|
---|