Fixed so that a passed-in parameter can specify the database to open

This commit is contained in:
Rich 2012-06-15 17:18:03 +00:00
parent 51312b4b38
commit 0e9a7efdae

View File

@ -109,19 +109,22 @@ namespace VEPROMS.CSLA.Library
}
private static string ChooseDatabase(string constr)
{
if (LastDatabase != "NoDefault" && LastDatabase != "")
if (_SelectedDatabase == null)
{
if (System.Windows.Forms.MessageBox.Show("Open " + LastDatabase, "Reopen Last Database", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
if (LastDatabase != "NoDefault" && LastDatabase != "")
{
SelectedDatabase = LastDatabase;
return constr.Replace("{MENU}", _SelectedDatabase);
if (System.Windows.Forms.MessageBox.Show("Open " + LastDatabase, "Reopen Last Database", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
{
SelectedDatabase = LastDatabase;
return constr.Replace("{MENU}", _SelectedDatabase);
}
}
System.Windows.Forms.ContextMenuStrip cms = BuildDatabaseMenu(constr);
while (_SelectedDatabase == null)
{
cms.Show(new System.Drawing.Point((System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - cms.Width) / 2, (System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - cms.Height) / 2));
System.Windows.Forms.Application.DoEvents();
}
}
System.Windows.Forms.ContextMenuStrip cms = BuildDatabaseMenu(constr);
while (_SelectedDatabase == null)
{
cms.Show(new System.Drawing.Point((System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - cms.Width) / 2, (System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - cms.Height) / 2));
System.Windows.Forms.Application.DoEvents();
}
return constr.Replace("{MENU}", _SelectedDatabase);
}