public void HandleLogin(IUser user) { _currentUser = user; foreach (var page in _removeAfterLogin) { _pageViewModels.Remove(page); } CurrentPageViewModel = _pageViewModels.First(); CurrentPageViewModel.OnEntry(); _pageViewModels.Add(new LogoutViewModel()); _pageViewModels.Add(new EditDictionaryViewModel(_dao, _currentUser)); _pageViewModels.Add(new ConnectWordsViewModel(_dao)); _pageViewModels.Add(new LearnViewModel(_dao, _currentUser)); }
private void ChangeViewModel(IPageViewModel viewModel) { if (!PageViewModels.Contains(viewModel)) { PageViewModels.Add(viewModel); } if (CurrentPageViewModel.Name.Equals("Home")) { ((HomeViewModel)CurrentPageViewModel).OnExit(); } CurrentPageViewModel = PageViewModels.FirstOrDefault(vm => vm == viewModel); CurrentPageViewModel.OnEntry(); if (CurrentPageViewModel.Name.Equals("Logout")) { HandleLogout(); } }