protected override void ShowView(IWindowView view, bool isDialog, IDataContext context) { var currentViewModel = context.GetData(NavigationConstants.ViewModel); var topViewModel = NavigationDispatcher.GetOpenedViewModels(NavigationType.Window).LastOrDefault(vm => vm != currentViewModel); if (topViewModel != null) { view.Owner = topViewModel.Settings.Metadata.GetData(ViewModelConstants.View); } try { if (isDialog) { view.ShowDialog(); } else { view.Show(); } } catch { if (isDialog) { view.Close(); } throw; } }
protected virtual void OnApplicationStart() { var openedViewModels = NavigationDispatcher.GetOpenedViewModels(NavigationType.Page); foreach (var openedViewModel in openedViewModels) { Tracer.Warn($"There is an open view model {openedViewModel} after app restart"); NavigationDispatcher.OnNavigated(new NavigationContext(NavigationType.Page, NavigationMode.Remove, openedViewModel.ViewModel, null, this)); } }