private void buttonSettingsApply_Click(object sender, EventArgs e) { // - - - SAVE SETINGS - - - // // Save default Document Type CustomConfigurationManager.SetDefaultDocumentGroup(((KeyValuePair <string, string>)comboBoxDefaultDocumentGroup.SelectedItem).Key); // Save default Base Url CustomConfigurationManager.SetDefaultBaseUrl(((KeyValuePair <string, string>)comboBoxBaseUrlListName.SelectedItem).Key); // Disable "Apply" button buttonSettingsApply.Enabled = false; }
private void SettingsPane_Load(object sender, EventArgs e) { // - - - DOCUMENT GROUP - - - // // Bind dictionary with divisions comboBoxDefaultDocumentGroup.DataSource = new BindingSource(CustomConfigurationManager.GetDocumentGroupList(), null); comboBoxDefaultDocumentGroup.DisplayMember = "Value"; comboBoxDefaultDocumentGroup.ValueMember = "Key"; // set default division string defaultDocumentGroup = CustomConfigurationManager.GetDefaultDocumentGroup(); foreach (KeyValuePair <string, string> item in comboBoxDefaultDocumentGroup.Items) { if (item.Key == defaultDocumentGroup) { comboBoxDefaultDocumentGroup.SelectedIndex = comboBoxDefaultDocumentGroup.Items.IndexOf(item); break; } } // - - - BASE URL - - - // // Bind dictionary with Base Urls comboBoxBaseUrlListName.DataSource = new BindingSource(CustomConfigurationManager.GetBaseUrlList(), null); comboBoxBaseUrlListName.DisplayMember = "Key"; comboBoxBaseUrlListName.ValueMember = "Value"; // set default Base Url string defaultBaseUrl = CustomConfigurationManager.GetDefaultBaseUrlName(); foreach (KeyValuePair <string, string> item in comboBoxBaseUrlListName.Items) { if (item.Key == defaultBaseUrl) { comboBoxBaseUrlListName.SelectedIndex = comboBoxBaseUrlListName.Items.IndexOf(item); break; } } // Disable "Apply" button buttonSettingsApply.Enabled = false; }
private void MyUserControlTaskPane_Load(object sender, EventArgs e) { // Bind dictionary with divisions comboBoxDocumentGroup.DataSource = new BindingSource(CustomConfigurationManager.GetDocumentGroupList(), null); comboBoxDocumentGroup.DisplayMember = "Value"; comboBoxDocumentGroup.ValueMember = "Key"; // set default division string defaultDocumentGroup = CustomConfigurationManager.GetDefaultDocumentGroup(); foreach (KeyValuePair <string, string> item in comboBoxDocumentGroup.Items) { if (item.Key == defaultDocumentGroup) { comboBoxDocumentGroup.SelectedIndex = comboBoxDocumentGroup.Items.IndexOf(item); break; } } var productVersion = Assembly.GetExecutingAssembly().GetName().Version; labelVersion.Text = "V" + productVersion; }