using System.Collections.Generic;
using System.Windows;
public class UniqueWindow
{
private static readonly List<Window> windows = new();
public static T Get<T>() where T : Window, new()
{
var window = windows.Find(w => w is T);
if (window == null)
{
window = new T();
window.Closed += (_, _) => windows.Remove(window);
windows.Add(window);
}
return (T)window;
}
}