internal bool LoadByConfig(ConfigSetup configs, out List<string> exceptions) { exceptions = new List<string>(); Reset(); if (String.IsNullOrEmpty(configs.Owner)) return true; cmBoxSchema.SelectedIndexChanged -= cmBoxSchema_SelectedIndexChanged; cmBoxSchema.SelectedValue = configs.Owner; if (cmBoxSchema.SelectedIndex.In(0, -1)) { MessageBox.Show("Loaded configuration references a non-existent schema!"); return false; } cmBoxSchema.SelectedIndexChanged += cmBoxSchema_SelectedIndexChanged; LoadObjectTypeCombo(); if (String.IsNullOrEmpty(configs.SelectedObjectType)) return true; cmBoxObjectType.SelectedIndexChanged -= cmBoxObjectType_SelectedIndexChanged; cmBoxObjectType.SelectedValue = configs.SelectedObjectType; cmBoxObjectType.SelectedIndexChanged += cmBoxObjectType_SelectedIndexChanged; txtFiltro.Enabled = true; List<IDbObjectModel> objs = SearchAllObjects(); exceptions = CleanupObjects(objs); RefreshObjects(); return true; }
private void salvaConfigurazioneToolStripMenuItem_Click(object sender, EventArgs e) { saveConfigFileDialog.FileName = String.IsNullOrEmpty(LastLoadedConfig) ? "Config.config" : LastLoadedConfig; if (saveConfigFileDialog.ShowDialog() != DialogResult.OK) return; ConfigSetup config = new ConfigSetup { MappingNamespace = txtMappingNamespace.Text, ModelNamespace = txtDomainNamespace.Text, tables = tables, Owner = objectSelector.SelectedOwner, SelectedObjectType = objectSelector.SelectedObjectType, Version = ExpectedConfigVersion }; config.Save(saveConfigFileDialog.FileName); MessageBox.Show("Configuration save succesfull.", "Configuration saved", MessageBoxButtons.OK, MessageBoxIcon.Information); }