Fix(Back-End): Navigation Menu Up
continuous-integration/drone/push Build is failing Details

Back-End
Louis DUFOUR 2 years ago
parent 58d1e5130a
commit e17371c514

@ -42,12 +42,15 @@
<StackLayout> <StackLayout>
<Label FontSize="35" FontFamily="SF-Pro-Display-Bold" Padding="10">Mes livres</Label> <Label FontSize="35" FontFamily="SF-Pro-Display-Bold" Padding="10">Mes livres</Label>
<Rectangle HeightRequest="1" BackgroundColor="black" VerticalOptions="End" /> <Rectangle HeightRequest="1" BackgroundColor="black" VerticalOptions="End" />
<CollectionView ItemsSource="{Binding MenuItemsLivre}" Margin="25,0,0,0" BackgroundColor="#F9F9F9"> <CollectionView ItemsSource="{Binding MenuItemsLivre}"
SelectedItem="{Binding Source={x:Reference ThisPage}, Path=Nav.SelectedItem, Mode=TwoWay}"
Margin="25,0,0,0" BackgroundColor="#F9F9F9">
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate> <DataTemplate>
<Grid RowDefinitions="Auto" Style="{StaticResource StyleCollectionGrid}" Padding="2"> <Grid RowDefinitions="Auto" Style="{StaticResource StyleCollectionGrid}" Padding="2">
<Grid.GestureRecognizers> <Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding Source={x:Reference ThisPage}, Path=Nav.MenuItemsCommand}"/> <TapGestureRecognizer Command="{Binding Source={x:Reference ThisPage}, Path=Nav.ItemTappedCommand}"
CommandParameter="{Binding .}"/>
</Grid.GestureRecognizers> </Grid.GestureRecognizers>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="25"/> <ColumnDefinition Width="25"/>

@ -1,12 +1,20 @@
using BookApp.Pages; using BookApp.Pages;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using BookApp.ViewModel; using BookApp.ViewModel;
using System.Diagnostics;
namespace BookApp namespace BookApp
{ {
public partial class MainPage : ContentPage public partial class MainPage : ContentPage
{ {
public ViewModelNavigation Nav { get; } public ViewModelNavigation Nav { get; } = new ViewModelNavigation();
void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
Debug.WriteLine(
$"Selection Changed: Added:{e.CurrentSelection.FirstOrDefault()}, Removed:{e.PreviousSelection.FirstOrDefault()}"
);
}
public MainPage(ViewModelMenu data) public MainPage(ViewModelMenu data)
{ {

@ -8,6 +8,7 @@ namespace BookApp.Pages
public partial class Tous : ContentPage public partial class Tous : ContentPage
{ {
public ViewModelNavigation VMNav { get; } public ViewModelNavigation VMNav { get; }
public Tous(BookViewModel data) public Tous(BookViewModel data)
{ {
InitializeComponent(); InitializeComponent();

@ -29,7 +29,7 @@
<VisualState x:Name="Selected"> <VisualState x:Name="Selected">
<VisualState.Setters> <VisualState.Setters>
<Setter Property="BackgroundColor" <Setter Property="BackgroundColor"
Value="Transparent" /> Value="Purple" />
</VisualState.Setters> </VisualState.Setters>
</VisualState> </VisualState>
</VisualStateGroup> </VisualStateGroup>

@ -23,17 +23,24 @@ namespace BookApp.ViewModel
public INavigation Navigation { get; set; } public INavigation Navigation { get; set; }
public ICommand MenuItemsFiltre { get; private set; } public ICommand MenuItemsFiltre { get; private set; }
public ICommand MenuItemsCommand { get; private set; }
public ICommand BookSelected { get; private set; } public ICommand BookSelected { get; private set; }
public ICommand BackButtonCommand { get; private set; } public ICommand BackButtonCommand { get; private set; }
// Command du menu
private ICommand _itemTappedCommand;
public ICommand ItemTappedCommand =>
_itemTappedCommand ??= new CommandPersonnal<ViewModelMenuItem>(
async (item) => await OnItemSelected(item)
);
public ViewModelNavigation() public ViewModelNavigation()
{ {
MenuItemsFiltre = new CommandPersonnal(async () => await OnItemSelected(SelectedItem)); MenuItemsFiltre = new CommandPersonnal(async () => await OnItemSelected(SelectedItem));
MenuItemsCommand = new CommandPersonnal(async () => await OnItemSelected(SelectedItem));
BackButtonCommand = new CommandPersonnal(async () => await BackButton(this, EventArgs.Empty)); BackButtonCommand = new CommandPersonnal(
async () => await BackButton(this, EventArgs.Empty)
);
BookSelected = new CommandPersonnal(async () => await OnBookSelected(SelectedBook)); BookSelected = new CommandPersonnal(async () => await OnBookSelected(SelectedBook));
} }

@ -8,8 +8,6 @@ namespace VMWrapper
{ {
public class DetailBookViewModel public class DetailBookViewModel
{ {
public DetailBookViewModel() public DetailBookViewModel() { }
{
}
} }
} }

@ -18,7 +18,6 @@ namespace VMWrapper
public ObservableCollection<Book> bookList { get; private set; } = public ObservableCollection<Book> bookList { get; private set; } =
new ObservableCollection<Book>(); new ObservableCollection<Book>();
public FilterViewModel(ILibraryManager data) public FilterViewModel(ILibraryManager data)
{ {
this.data = data; this.data = data;
@ -29,15 +28,12 @@ namespace VMWrapper
{ {
try try
{ {
var books = data.GetBooksByAuthor("", 0, 5).Result.Item2; var books = data.GetBooksByAuthor("", 0, 5).Result.Item2;
foreach (Book book in books) foreach (Book book in books)
{ {
bookList.Add(book); bookList.Add(book);
} }
} }
catch (Exception ex) catch (Exception ex)
{ {

@ -15,8 +15,6 @@ namespace VMWrapper
this.data = data; this.data = data;
} }
/* public ICommand PerformSearch => new Command<string>((string query) => /* public ICommand PerformSearch => new Command<string>((string query) =>
{ {
SearchResults = DataService.GetSearchResults(query); SearchResults = DataService.GetSearchResults(query);

Loading…
Cancel
Save