ADD : avancement Navigation from MenuPage ( nullexception with SelectedValue ToFix)

commands-19-09
Lou BRODA 1 year ago
parent 569d16e571
commit 844f9b97fb

@ -55,8 +55,7 @@
ButtonNumber="{Binding BibliothequeVM.Manager.NbBooks}" ButtonNumber="{Binding BibliothequeVM.Manager.NbBooks}"
ButtonRedIconVisible="False" ButtonRedIconVisible="False"
ButtonBlackIconVisible="True" ButtonBlackIconVisible="True"
ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}" ButtonTappedCommand="{Binding BibliothequeVM.AllBooksNavigateCommand}"/>
CommandParameter="tous/"/>
<contentView:SeparatorCutStartView/> <contentView:SeparatorCutStartView/>
@ -119,8 +118,7 @@
ButtonIcon="person_fill.png" ButtonIcon="person_fill.png"
ButtonRedIconVisible="False" ButtonRedIconVisible="False"
ButtonBlackIconVisible="True" ButtonBlackIconVisible="True"
ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}" ButtonTappedCommand="{Binding BibliothequeVM.AllAuthorsNavigateCommand}"/>
CommandParameter="auteur/"/>
<contentView:SeparatorCutStartView/> <contentView:SeparatorCutStartView/>
@ -129,8 +127,7 @@
ButtonIcon="calendar.png" ButtonIcon="calendar.png"
ButtonRedIconVisible="False" ButtonRedIconVisible="False"
ButtonBlackIconVisible="True" ButtonBlackIconVisible="True"
ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}" ButtonTappedCommand="{Binding BibliothequeVM.AllDatesNavigateCommand}"/>
CommandParameter="date/"/>
<contentView:SeparatorCutStartView/> <contentView:SeparatorCutStartView/>
@ -139,8 +136,7 @@
ButtonIcon="sparkles.png" ButtonIcon="sparkles.png"
ButtonRedIconVisible="False" ButtonRedIconVisible="False"
ButtonBlackIconVisible="True" ButtonBlackIconVisible="True"
ButtonTappedCommand="{Binding BibliothequeVM.Navigator.NavigationCommand}" ButtonTappedCommand="{Binding BibliothequeVM.AllRatingsNavigateCommand}"/>
CommandParameter="note/"/>
<contentView:SeparatorEntireView/> <contentView:SeparatorEntireView/>
</VerticalStackLayout> </VerticalStackLayout>

@ -23,12 +23,5 @@ public partial class FiltrageAuteurView : ContentPage
#region Methods #region Methods
protected override void OnAppearing()
{
base.OnAppearing();
FiltrageAuteurVM.Manager.GetAllAuthorsCommand.Execute(null);
}
#endregion #endregion
} }

@ -18,6 +18,7 @@
</Grid.RowDefinitions> </Grid.RowDefinitions>
<view:HeaderPage HeaderTitle="Date de publication" <view:HeaderPage HeaderTitle="Date de publication"
HeaderBackButtonText="Mes livres"
HeaderPlusButtonVisible="False" HeaderPlusButtonVisible="False"
HeaderSwitchButtonVisible="True" HeaderSwitchButtonVisible="True"
ButtonPlusTappedCommand="{Binding FiltrageDateVM.Navigator.PopupHomePlusNavigationCommand}" ButtonPlusTappedCommand="{Binding FiltrageDateVM.Navigator.PopupHomePlusNavigationCommand}"
@ -37,9 +38,9 @@
<contentView:SeparatorEntireView/> <contentView:SeparatorEntireView/>
<CollectionView ItemsSource="{Binding FiltrageDateVM.Manager.AllPublishDates}" <CollectionView ItemsSource="{Binding FiltrageDateVM.Manager.AllPublishDates}"
SelectionMode="Single"
SelectedItem="{Binding FiltrageDateVM.Manager.SelectedDate}" SelectedItem="{Binding FiltrageDateVM.Manager.SelectedDate}"
SelectionChangedCommand="{Binding FiltrageDateVM.Navigator.NavigationCommand}" SelectionChangedCommand="{Binding FiltrageDateVM.NavigateDatePageCommand}">
SelectionChangedCommandParameter="{Binding FiltrageDateVM.Manager.SelectedDate}">
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate x:DataType="viewModel:PublishDateVM"> <DataTemplate x:DataType="viewModel:PublishDateVM">
<VerticalStackLayout> <VerticalStackLayout>

@ -23,12 +23,5 @@ public partial class FiltrageDateView : ContentPage
#region Methods #region Methods
protected override void OnAppearing()
{
base.OnAppearing();
FiltrageDateVM.Manager.GetAllPublishDatesCommand.Execute(null);
}
#endregion #endregion
} }

@ -38,8 +38,8 @@
<contentView:SeparatorEntireView/> <contentView:SeparatorEntireView/>
<CollectionView ItemsSource="{Binding FiltrageNoteVM.Manager.AllRatings}" <CollectionView ItemsSource="{Binding FiltrageNoteVM.Manager.AllRatings}"
SelectionChangedCommand="{Binding FiltrageNoteVM.Navigator.NavigationCommand}" SelectionMode="Single"
SelectionChangedCommandParameter="/tous"> SelectionChangedCommand="{Binding FiltrageNoteVM.NavigateRatingPageCommand}">
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate x:DataType="viewModel:RatingsVM"> <DataTemplate x:DataType="viewModel:RatingsVM">
<VerticalStackLayout> <VerticalStackLayout>

@ -23,12 +23,5 @@ public partial class FiltrageNoteView : ContentPage
#region Methods #region Methods
protected override void OnAppearing()
{
base.OnAppearing();
FiltrageNoteVM.Manager.GetAllRatingsCommand.Execute(null);
}
#endregion #endregion
} }

@ -35,12 +35,5 @@ public partial class TousView : ContentPage
} }
} }
protected override void OnAppearing()
{
base.OnAppearing();
TousVM.Manager.GetBooksFromCollectionCommand.Execute(null);
}
#endregion #endregion
} }

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using ViewModels; using ViewModels;
namespace LivreLand.ViewModel namespace LivreLand.ViewModel
@ -16,6 +17,14 @@ namespace LivreLand.ViewModel
public ManagerVM Manager { get; private set; } public ManagerVM Manager { get; private set; }
public ICommand AllBooksNavigateCommand { get; private set; }
public ICommand AllAuthorsNavigateCommand { get; private set; }
public ICommand AllDatesNavigateCommand { get; private set; }
public ICommand AllRatingsNavigateCommand { get; private set; }
#endregion #endregion
#region Constructor #region Constructor
@ -24,6 +33,38 @@ namespace LivreLand.ViewModel
{ {
Navigator = navigatorVM; Navigator = navigatorVM;
Manager = managerVM; Manager = managerVM;
AllBooksNavigateCommand = new RelayCommand(() => AllBooksNavigate());
AllAuthorsNavigateCommand = new RelayCommand(() => AllAuthorsNavigate());
AllDatesNavigateCommand = new RelayCommand(() => AllDatesNavigate());
AllRatingsNavigateCommand = new RelayCommand(() => AllRatingsNavigate());
}
#endregion
#region Methods
private void AllBooksNavigate()
{
Manager.GetBooksFromCollectionCommand.Execute(null);
Navigator.NavigationCommand.Execute("/tous");
}
private void AllAuthorsNavigate()
{
Manager.GetAllAuthorsCommand.Execute(null);
Navigator.NavigationCommand.Execute("/auteur");
}
private void AllDatesNavigate()
{
Manager.GetAllPublishDatesCommand.Execute(null);
Navigator.NavigationCommand.Execute("/date");
}
private void AllRatingsNavigate()
{
Manager.GetAllRatingsCommand.Execute(null);
Navigator.NavigationCommand.Execute("/note");
} }
#endregion #endregion

@ -34,7 +34,7 @@ namespace LivreLand.ViewModel
#region Methods #region Methods
private async Task NavigateAuthorPage() private void NavigateAuthorPage()
{ {
Manager.GetBooksByAuthorCommand.Execute(null); Manager.GetBooksByAuthorCommand.Execute(null);
Navigator.NavigationCommand.Execute("/tous"); Navigator.NavigationCommand.Execute("/tous");

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using ViewModels; using ViewModels;
namespace LivreLand.ViewModel namespace LivreLand.ViewModel
@ -16,6 +17,8 @@ namespace LivreLand.ViewModel
public ManagerVM Manager { get; private set; } public ManagerVM Manager { get; private set; }
public ICommand NavigateDatePageCommand { get; private set; }
#endregion #endregion
#region Constructor #region Constructor
@ -24,6 +27,17 @@ namespace LivreLand.ViewModel
{ {
Navigator = navigatorVM; Navigator = navigatorVM;
Manager = managerVM; Manager = managerVM;
NavigateDatePageCommand = new RelayCommand(() => NavigateDatePage());
}
#endregion
#region Methods
private void NavigateDatePage()
{
Manager.GetBooksByDateCommand.Execute(null);
Navigator.NavigationCommand.Execute("/tous");
} }
#endregion #endregion

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
using ViewModels; using ViewModels;
namespace LivreLand.ViewModel namespace LivreLand.ViewModel
@ -16,6 +17,8 @@ namespace LivreLand.ViewModel
public ManagerVM Manager { get; private set; } public ManagerVM Manager { get; private set; }
public ICommand NavigateRatingPageCommand { get; private set; }
#endregion #endregion
#region Constructor #region Constructor
@ -24,6 +27,17 @@ namespace LivreLand.ViewModel
{ {
Navigator = navigatorVM; Navigator = navigatorVM;
Manager = managerVM; Manager = managerVM;
NavigateRatingPageCommand = new RelayCommand(() => NavigateRatingPage());
}
#endregion
#region Methods
private void NavigateRatingPage()
{
Manager.GetBooksByRatingCommand.Execute(null);
Navigator.NavigationCommand.Execute("/tous");
} }
#endregion #endregion

@ -27,6 +27,8 @@ namespace ViewModels
private long nbBooks; private long nbBooks;
private AuthorVM selectedAuthor; private AuthorVM selectedAuthor;
private PublishDateVM selectedDate;
private RatingsVM selectedRating;
private ContactVM selectedContact; private ContactVM selectedContact;
private string givenFirstName; private string givenFirstName;
@ -105,9 +107,31 @@ namespace ViewModels
} }
} }
public PublishDateVM SelectedDate { get; private set; } public PublishDateVM SelectedDate
{
get { return selectedDate; }
set
{
if (selectedDate != value)
{
selectedDate = value;
OnPropertyChanged(nameof(SelectedDate));
}
}
}
public RatingsVM SelectedRating { get; private set; } public RatingsVM SelectedRating
{
get { return selectedRating; }
set
{
if (selectedRating != value)
{
selectedRating = value;
OnPropertyChanged(nameof(SelectedRating));
}
}
}
public Status SelectedStatus { get; set; } public Status SelectedStatus { get; set; }

Loading…
Cancel
Save