mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-08-16 06:31:42 +02:00
Configuration
Core
Bridge
Controls
Handling
Management
Notification
Other
Utils
FormBrowser.Designer.cs
FormBrowser.cs
FormBrowser.resx
FormManager.cs
TweetDeckBrowser.cs
Data
Plugins
Properties
Resources
Updates
bld
lib
subprocess
video
.gitattributes
.gitignore
LICENSE.md
Program.cs
README.md
Reporter.cs
TweetDuck.csproj
TweetDuck.sln
TweetDuck.sln.DotSettings
packages.config
31 lines
851 B
C#
31 lines
851 B
C#
using System.Linq;
|
|
using System.Windows.Forms;
|
|
|
|
namespace TweetDuck.Core{
|
|
static class FormManager{
|
|
public static T TryFind<T>() where T : Form{
|
|
return Application.OpenForms.OfType<T>().FirstOrDefault();
|
|
}
|
|
|
|
public static bool TryBringToFront<T>() where T : Form{
|
|
T form = TryFind<T>();
|
|
|
|
if (form != null){
|
|
form.BringToFront();
|
|
return true;
|
|
}
|
|
else return false;
|
|
}
|
|
|
|
public static bool HasAnyDialogs => Application.OpenForms.OfType<IAppDialog>().Any();
|
|
|
|
public static void CloseAllDialogs(){
|
|
foreach(IAppDialog dialog in Application.OpenForms.OfType<IAppDialog>().Reverse()){
|
|
((Form)dialog).Close();
|
|
}
|
|
}
|
|
|
|
public interface IAppDialog{}
|
|
}
|
|
}
|