private static void CloseView(string correlationId) { if (_cacheMultiple.ContainsKey(correlationId) && _cacheMultiple[correlationId].IsAlive) { ResponsiveMDIChild view = _cacheMultiple[correlationId].Target as ResponsiveMDIChild; if (view != null) { view.Close(); } _cacheMultiple[correlationId].Target = null; _cacheMultiple.Remove(correlationId); } List <string> deleteItems = new List <string>(); foreach (var item in _cacheMultiple) { if (item.Value.IsAlive == false || item.Value.Target == null) { deleteItems.Add(item.Key); } } foreach (var item in deleteItems) { _cacheMultiple.Remove(item); } }
private static void CloseView(ViewType viewType) { if (_cacheSingle.ContainsKey(viewType) && _cacheSingle[viewType].IsAlive) { ResponsiveMDIChild view = _cacheSingle[viewType].Target as ResponsiveMDIChild; if (view != null) { view.Close(); } _cacheSingle[viewType].Target = null; _cacheSingle.Remove(viewType); } List <ViewType> deleteItems = new List <ViewType>(); foreach (var item in _cacheSingle) { if (item.Value.IsAlive == false || item.Value.Target == null) { deleteItems.Add(item.Key); } } foreach (var item in deleteItems) { _cacheSingle.Remove(item); } }