private void ContentOnRequestClose(IRequestClose item) { item.Guard("item"); IWindowWrapper window; if (!windows.TryGetValue(item, out window)) { return; } window.Close(); windows.Remove(item); }
/// <summary> /// Opens the new. /// </summary> /// <param name="content">The content.</param> /// <param name="title">The title.</param> /// <param name="desiredWidth">Width of the desired.</param> /// <param name="desiredHeight">Height of the desired.</param> /// <param name="header">The header.</param> /// <returns></returns> public IWindowWrapper OpenNew(IRequestClose content, string title, int desiredWidth, int desiredHeight, object header = null) { content.Guard("content"); var window = windowFactory.CreateNew(); window.Closing += WindowOnClosing; content.RequestClose += ContentOnRequestClose; window.Content = content; window.Title = title; window.Header = header; window.Width = desiredWidth; window.Height = desiredHeight; windows.Add(content, window); window.Show(); window.Activate(); window.Focus(); return(window); }