public void NavigateTo <T>(bool storeBack = false) where T : ClosableViewModel { var viewModel = _serviceLocator.GetInstance <T>(); var mainViewModel = _serviceLocator.GetInstance <WindowsMainViewModel>(); if (!storeBack) { _backStack.Clear(); } if (WindowsDialogService.GetRegisteredTypes().Contains(typeof(T))) { if (storeBack) { _backStack.Push(viewModel); } _dialogService.ShowDialog(viewModel); } else { if (storeBack) { _backStack.Push(mainViewModel.CurrentWorkspace); } mainViewModel.NavigateTo(viewModel); } }
public void NavigateBack() { var backViewModel = _backStack.Pop(); if (WindowsDialogService.GetRegisteredTypes().Contains(backViewModel.GetType())) { backViewModel.CloseCommand.Execute(null); } else { var mainViewModel = _serviceLocator.GetInstance <WindowsMainViewModel>(); mainViewModel.NavigateTo(backViewModel); } }