public static T CreateModalWindow <T>(PleasantWindow host = null, params object[] args) where T : PleasantModalWindow { T foundWindow = FindModalWindow <T>(); if (foundWindow != null && foundWindow.CanOpen) { return(null); } T window = (T)Activator.CreateInstance(typeof(T), args); OtherModalWindows.Add(window); if (host != null) { window.Show(host); } return(window); }
public static T FindModalWindow <T>() where T : PleasantModalWindow { return((T)OtherModalWindows.FirstOrDefault(x => x is T)); }