/// <summary> /// Start the configuration process... /// </summary> private void btnContinue_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; btnContinue.Enabled = false; try { // Start by creating the configuration file XmlDocument configFile = new XmlDocument(); configFile.LoadXml(Resources.Empty); IDatabaseProvider conf = cbxProviderType.SelectedItem as IDatabaseProvider; // Do an easy config ... first with the connection strings foreach (IConfigurableFeature pnl in ConfigurationApplicationContext.s_configurationPanels) { if (pnl is IDataboundFeature) { (pnl as IDataboundFeature).ConnectionString = conf.CreateConnectionStringElement(configFile, txtDatabaseAddress.Text, txtUserName.Text, txtPassword.Text, cbxDatabase.SelectedItem.ToString()); (pnl as IDataboundFeature).DataProvider = conf; } } // Easy or complex? if (rdoEasy.Checked) { // Save the configuration var progress = new frmProgress(); int i = 0; try { progress.Show(); foreach (IConfigurableFeature pnl in ConfigurationApplicationContext.s_configurationPanels) { progress.Status = (int)((++i / (float)ConfigurationApplicationContext.s_configurationPanels.Count) * 100); progress.StatusText = String.Format("Applying Configuration for {0}...", pnl.ToString()); //pnl.EnableConfiguration = true; pnl.EasyConfigure(configFile); } } catch (Exception ex) { #if DEBUG MessageBox.Show(ex.ToString(), "Error Configuring Service"); #else MessageBox.Show(ex.Message, "Error Configuring Service"); #endif foreach (IConfigurableFeature pnl in ConfigurationApplicationContext.s_configurationPanels) { progress.Status = (int)((i-- / (float)ConfigurationApplicationContext.s_configurationPanels.Count) * 100); progress.StatusText = String.Format("Removing Configuration for {0}...", pnl.ToString()); pnl.UnConfigure(configFile); } return; } finally { progress.Close(); } configFile.Save(ConfigurationApplicationContext.s_configFile); this.DialogResult = DialogResult.OK; } else { configFile.Save(ConfigurationApplicationContext.s_configFile); this.DialogResult = DialogResult.OK; } this.Close(); } finally { Cursor = Cursors.Default; btnContinue.Enabled = true; } }