mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-15 23:34:07 +02:00
26 lines
723 B
C#
26 lines
723 B
C#
using System.Linq;
|
|
using System.Windows.Forms;
|
|
using TweetDuck.Core.Other;
|
|
|
|
namespace TweetDuck.Core{
|
|
static class FormManager{
|
|
public static bool TryBringToFront<T>() where T : Form{
|
|
T form = Application.OpenForms.OfType<T>().FirstOrDefault();
|
|
|
|
if (form != null){
|
|
form.BringToFront();
|
|
return true;
|
|
}
|
|
else return false;
|
|
}
|
|
|
|
public static void CloseAllDialogs(){
|
|
foreach(Form form in Application.OpenForms.Cast<Form>().Reverse()){
|
|
if (form is FormSettings || form is FormPlugins || form is FormAbout){
|
|
form.Close();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|