Bring popup to front instead of alert

Any call to open a form that is already open (special characters, box
report, database) would alert that it's already open. Just bring it to
the front. Since it may be hidden, just move it back into view (align to
main program's top-left location)
This commit is contained in:
Kaphotics 2016-04-07 22:16:08 -07:00
parent e66342fe6c
commit 1c531b0673
2 changed files with 12 additions and 8 deletions

View file

@ -302,8 +302,9 @@ namespace PKHeX
}
private void mainMenuBoxReport(object sender, EventArgs e)
{
if (Application.OpenForms.Cast<Form>().Any(form => form.Name == typeof(frmReport).Name))
{ Util.Alert("Window is already open."); return; }
var z = Application.OpenForms.Cast<Form>().FirstOrDefault(form => form.Name == typeof(frmReport).Name) as frmReport;
if (z != null)
{ z.Location = Location; z.BringToFront(); return; }
frmReport ReportForm = new frmReport();
ReportForm.Show();
@ -311,8 +312,9 @@ namespace PKHeX
}
private void mainMenuDatabase(object sender, EventArgs e)
{
if (Application.OpenForms.Cast<Form>().Any(form => form.Name == typeof(SAV_Database).Name))
{ Util.Alert("Window is already open."); return; }
var z = Application.OpenForms.Cast<Form>().FirstOrDefault(form => form.Name == typeof(SAV_Database).Name) as SAV_Database;
if (z != null)
{ z.Location = Location; z.BringToFront(); return; }
if (Directory.Exists("db"))
new SAV_Database(this).Show();
@ -1986,8 +1988,9 @@ namespace PKHeX
if (ModifierKeys != Keys.Control)
return;
if (Application.OpenForms.Cast<Form>().Any(form => form.Name == typeof(f2_Text).Name))
{ Util.Alert("Window is already open."); return; }
var z = Application.OpenForms.Cast<Form>().FirstOrDefault(form => form.Name == typeof(f2_Text).Name) as f2_Text;
if (z != null)
{ z.Location = Location; z.BringToFront(); return; }
new f2_Text(tb).Show();
}
private void updateNotOT(object sender, EventArgs e)

View file

@ -547,8 +547,9 @@ namespace PKHeX
if (ModifierKeys != Keys.Control)
return;
if (Application.OpenForms.Cast<Form>().Any(form => form.Name == typeof(f2_Text).Name))
{ Util.Alert("Window is already open."); return; }
var z = Application.OpenForms.Cast<Form>().FirstOrDefault(form => form.Name == typeof(f2_Text).Name) as f2_Text;
if (z != null)
{ z.Location = Location; z.BringToFront(); return; }
new f2_Text(tb).Show();
}
private void showTSV(object sender, EventArgs e)