ready for display Modal

This commit is contained in:
Natlinux81
2022-08-13 03:55:31 +02:00
parent 29013ae275
commit 13f70e8c4b
9 changed files with 186 additions and 14 deletions

View File

@@ -0,0 +1,38 @@
using Apollon.WPF.Stores;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Apollon.WPF.ViewModels
{
public class MainViewModel : ViewModelBase
{
private readonly ModalNavigationStore _modalNavigationStore;
public ViewModelBase CurrentModalViewModel => _modalNavigationStore.CurrentViewModel;
public bool IsModalOpen => _modalNavigationStore.IsOpen;
public OverviewViewModel OverviewViewModel { get; }
public MainViewModel(ModalNavigationStore modalNavigationStore, OverviewViewModel overviewViewModel)
{
_modalNavigationStore = modalNavigationStore;
OverviewViewModel = overviewViewModel;
_modalNavigationStore.CurrentViewModelChanged += ModalNavigationStore_CurrentViewModelChanged;
}
protected override void Dispose()
{
_modalNavigationStore.CurrentViewModelChanged -= ModalNavigationStore_CurrentViewModelChanged;
base.Dispose();
}
private void ModalNavigationStore_CurrentViewModelChanged()
{
OnPropertyChanged(nameof(CurrentModalViewModel));
OnPropertyChanged(nameof(IsModalOpen));
}
}
}