using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; namespace WpfApp29 { public class AppHelper { public static T? GetWindowAtType() where T: Window { foreach (var unknownWindoew in App.Current.Windows) { if (unknownWindoew is T window) { return window; } } return null; } } }