public SprocTestForm(Database cfg, ConnectionData connData, string configFileName) : this() { this.cfg = cfg; this.connData = connData; this.configurationFileName = configFileName; }
private void SprocTestConfigForm_Load(object sender, EventArgs e) { if (this.connData == null) { ConnectionForm frmConnect = new ConnectionForm("Stored Proc Testing"); DialogResult result = frmConnect.ShowDialog(); if (result == DialogResult.OK) { this.connData = frmConnect.SqlConnection; } else { MessageBox.Show("Stored Procedure Testing can not continue without a valid Sql Connection", "Unable to Load", MessageBoxButtons.OK, MessageBoxIcon.Hand); this.Close(); Application.Exit(); } } this.settingsControl1.Server = this.connData.SQLServerName; if (this.configFileName.Length > 0) { try { this.settingsControl1.Project = this.configFileName; testConfig = SqlSync.SprocTest.TestManager.ReadConfiguration(this.configFileName); this.connData.DatabaseName = testConfig.Name; BindTreeView(); pgBar.Style = ProgressBarStyle.Marquee; bgSprocList.RunWorkerAsync(); } catch (Exception exe) { MessageBox.Show("Error loading config file.\r\n" + exe.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } this.mruManager = new SqlSync.MRU.MRUManager(); this.mruManager.Initialize( this, // owner form fileToolStripMenuItem, mnuFileMRU, // Recent Files menu item @"Software\Michael McKechney\Sql Sync\Stored Proc Testing"); // Registry path to keep MRU list this.mruManager.MaxDisplayNameLength = 40; }
public void OpenMRUFile(string fileName) { this.Cursor = Cursors.WaitCursor; if (File.Exists(fileName)) { try { testConfig = SqlSync.SprocTest.TestManager.ReadConfiguration(fileName); this.connData.DatabaseName = testConfig.Name; } catch (Exception exe) { MessageBox.Show(exe.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { testConfig = new Database(); SetDatabaseForm frmDb = new SetDatabaseForm(DbInformation.InfoHelper.GetDatabaseList(this.connData), ""); frmDb.ShowDialog(); this.testConfig.Name = frmDb.CurrentDatabase; this.testConfig.SaveConfiguration(this.configFileName); } this.mruManager.Add(fileName); this.settingsControl1.Project = this.configFileName; BindTreeView(); while (bgSprocList.IsBusy) { System.Threading.Thread.Sleep(100); } this.Cursor = Cursors.Default; pgBar.Style = ProgressBarStyle.Marquee; bgSprocList.RunWorkerAsync(); }