Renavigate
This commit is contained in:
28
Apollon.WPF/Commands/NavigateCommand.cs
Normal file
28
Apollon.WPF/Commands/NavigateCommand.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
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.Commands
|
||||
{
|
||||
public class NavigateCommand<TViewModel> : CommandBase
|
||||
where TViewModel : ViewModelBase
|
||||
{
|
||||
private readonly NavigationStore _navigationStore;
|
||||
private readonly Func<TViewModel> _createViewModel;
|
||||
|
||||
public NavigateCommand(NavigationStore navigationStore, Func<TViewModel> createViewModel)
|
||||
{
|
||||
_navigationStore = navigationStore;
|
||||
_createViewModel = createViewModel;
|
||||
}
|
||||
|
||||
public override void Execute(object parameter)
|
||||
{
|
||||
_navigationStore.CurrentViewModel = _createViewModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user