public void LoadWindow(int windowId, WindowType windowType, WindowUI window) { mappedWindowIds.Add(windowId, window); if (!mappedWindowTypes.TryGetValue(windowType, out List <WindowUI> list)) { list = new List <WindowUI>(); mappedWindowTypes.Add(windowType, list); } else { WindowUI originalWindow = list.FirstOrDefault(); if (originalWindow != null) { window.Copy(originalWindow); } } mappedWindowTypes[windowType].Add(window); }