29 lines
767 B
C#
29 lines
767 B
C#
using Apollon.WPF.Stores;
|
|
using Apollon.WPF.ViewModels;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Apollon.WPF.Services
|
|
{
|
|
public class NavigationService<TViewModel>
|
|
where TViewModel : ViewModelBase
|
|
{
|
|
private readonly NavigationStore _navigationStore;
|
|
private readonly Func<TViewModel> _createViewModel;
|
|
|
|
public NavigationService(NavigationStore navigationStore, Func<TViewModel> createViewModel)
|
|
{
|
|
_navigationStore = navigationStore;
|
|
_createViewModel = createViewModel;
|
|
}
|
|
|
|
public void Navigate()
|
|
{
|
|
_navigationStore.CurrentViewModel = _createViewModel();
|
|
}
|
|
}
|
|
}
|