|
|
|
@ -1,5 +1,4 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using App.Pages;
|
|
|
|
|
using ViewModel;
|
|
|
|
|
|
|
|
|
@ -7,27 +6,37 @@ namespace App.ViewModel
|
|
|
|
|
{
|
|
|
|
|
public class ChampionListPageVM
|
|
|
|
|
{
|
|
|
|
|
public INavigation Navigation { get; set; }
|
|
|
|
|
#region Properties
|
|
|
|
|
|
|
|
|
|
public ChampionManagerVM ChampionManagerVM { get; private set; }
|
|
|
|
|
public INavigation Navigation { get; set; }
|
|
|
|
|
public ChampionManagerVM ChampionManagerVM { get; private set; }
|
|
|
|
|
|
|
|
|
|
public ICommand NavigateToChampionDetailCommand { get; private set; }
|
|
|
|
|
public ICommand NaviagteToChampionAddEditPageCommand { get; private set; }
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Commands
|
|
|
|
|
|
|
|
|
|
public ICommand NavigateToChampionDetailCommand { get; private set; }
|
|
|
|
|
public ICommand NaviagteToChampionAddEditPageCommand { get; private set; }
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public ChampionListPageVM(ChampionManagerVM championManager)
|
|
|
|
|
{
|
|
|
|
|
ChampionManagerVM = championManager;
|
|
|
|
|
{
|
|
|
|
|
ChampionManagerVM = championManager;
|
|
|
|
|
|
|
|
|
|
NavigateToChampionDetailCommand = new Command (
|
|
|
|
|
execute: async () => await Shell.Current.GoToAsync(nameof(ChampionDetailPage)),
|
|
|
|
|
canExecute: () => ChampionManagerVM is not null
|
|
|
|
|
);
|
|
|
|
|
NavigateToChampionDetailCommand = new Command<ChampionVM>(
|
|
|
|
|
execute: async (selectedChampion) =>
|
|
|
|
|
{
|
|
|
|
|
ChampionManagerVM.SelectedChampion = selectedChampion;
|
|
|
|
|
await Shell.Current.GoToAsync(nameof(ChampionDetailPage));
|
|
|
|
|
},
|
|
|
|
|
canExecute: (selectedChampion) => ChampionManagerVM is not null && selectedChampion is not null
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
NaviagteToChampionAddEditPageCommand = new Command(
|
|
|
|
|
execute: async () => await Navigation.PushModalAsync(new ChampionAddEditPage()),
|
|
|
|
|
canExecute: () => ChampionManagerVM is not null
|
|
|
|
|
NaviagteToChampionAddEditPageCommand = new Command<ChampionVM>(
|
|
|
|
|
execute: async (selectedChampion) => await Navigation.PushModalAsync(new ChampionAddEditPage()),
|
|
|
|
|
canExecute: (selectedChampion) => ChampionManagerVM is not null && Navigation is not null
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|