implement NavigateCommand
This commit is contained in:
@@ -9,25 +9,38 @@ namespace Apollon.WPF.ViewModels
|
||||
{
|
||||
public class MainViewModel : ViewModelBase
|
||||
{
|
||||
private readonly NavigationStore _navigationStore;
|
||||
private readonly ModalNavigationStore _modalNavigationStore;
|
||||
|
||||
public ViewModelBase CurrentModalViewModel => _modalNavigationStore.CurrentViewModel;
|
||||
public ViewModelBase CurrentViewModel => _navigationStore.CurrentViewModel;
|
||||
public bool IsModalOpen => _modalNavigationStore.IsOpen;
|
||||
public OverviewViewModel OverviewViewModel { get; }
|
||||
|
||||
|
||||
public MainViewModel(ModalNavigationStore modalNavigationStore, OverviewViewModel overviewViewModel)
|
||||
public MainViewModel(ModalNavigationStore modalNavigationStore, OverviewViewModel overviewViewModel, NavigationStore navigationStore)
|
||||
{
|
||||
_navigationStore = navigationStore;
|
||||
_modalNavigationStore = modalNavigationStore;
|
||||
OverviewViewModel = overviewViewModel;
|
||||
|
||||
|
||||
_modalNavigationStore.CurrentViewModelChanged += ModalNavigationStore_CurrentViewModelChanged;
|
||||
_navigationStore.CurrentViewModelChanged += NavigationStore_CurrentViewModelChanged;
|
||||
_modalNavigationStore.CurrentViewModelChanged += ModalNavigationStore_CurrentViewModelChanged;
|
||||
|
||||
}
|
||||
|
||||
protected override void Dispose()
|
||||
{
|
||||
_navigationStore.CurrentViewModelChanged -= NavigationStore_CurrentViewModelChanged;
|
||||
_modalNavigationStore.CurrentViewModelChanged -= ModalNavigationStore_CurrentViewModelChanged;
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
private void NavigationStore_CurrentViewModelChanged()
|
||||
{
|
||||
OnPropertyChanged(nameof(CurrentViewModel));
|
||||
}
|
||||
private void ModalNavigationStore_CurrentViewModelChanged()
|
||||
{
|
||||
OnPropertyChanged(nameof(CurrentModalViewModel));
|
||||
|
||||
Reference in New Issue
Block a user