Bootstrap

wpf windowController实现全局窗口管理

public class WindowController
{
   
    private static readonly Lazy<WindowController> _instance = new Lazy<WindowController>(() => new WindowController());
    public static WindowController Instance => _instance.Value;

    static private ConcurrentDictionary<Type, Window> _windows = new ConcurrentDictionary<Type, Window>();

    static public void RegisterWindow<T>() where T : Window, new()
    {
   
        Type windowKey = typeof(T);

        if (!_windows.ContainsKey(windowKey))
        {
   
            T window = new T();
            _windows.TryAdd(windowKey, window);
        }
        else
        {
   
            throw new ArgumentException($"Window with key '{
     <
;