public object ShowModal(string viewName, object data, Window owner) { object result = null; object view = ApplicationContext.GetObject(viewName); if (view != null) { Window window = view as Window; if (window != null) { window.Owner = owner; IInitView initView = view as IInitView; if (initView != null) { initView.Init(data); } window.WindowStartupLocation = WindowStartupLocation.CenterScreen; //bool isTaskBarView = (window as ITaskBarView) != null; //window.ShowInTaskbar = isTaskBarView; window.ShowDialog(); } } return(result); }
public Window Show(string viewName, object id, object data, Window owner) { string viewId = string.Format("{0}_{1}", viewName, id); Window window = GetOpenedWindow(viewId); if (window == null) { object view = ApplicationContext.GetObject(viewName); if (view != null) { window = view as Window; if (window != null) { window.Owner = owner; //bool isTaskBarView = (window as ITaskBarView) != null; //window.ShowInTaskbar = isTaskBarView; _openWindows.Add(viewId, window); } } IInitView initView = view as IInitView; if (initView != null) { initView.Init(data); } } if (window != null) { window.WindowStartupLocation = WindowStartupLocation.CenterScreen; window.Show(); if (!window.IsActive) { window.Activate(); } if (window.WindowState == WindowState.Minimized) { window.WindowState = WindowState.Normal; } } return(window); }