Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/ConnectionSetupView.cs @ 3069

Last change on this file since 3069 was 3069, checked in by gkronber, 14 years ago

Improved dialogs in plugin manager. #891 (Refactor GUI for plugin management)

File size: 2.4 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Drawing;
5using System.Data;
6using System.Linq;
7using System.Text;
8using System.Windows.Forms;
9
10namespace 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        form.ClientSize = Size;
50        this.Dock = DockStyle.Fill;
51        form.Controls.Add(this);
52      }
53      form.Show();
54    }
55  }
56}
Note: See TracBrowser for help on using the repository browser.