Add (Back-End): Navigation terminer
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
d87d16c481
commit
080b2702f8
@ -1,67 +1,14 @@
|
|||||||
|
using BookApp.ViewModel;
|
||||||
|
using Model;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
namespace BookApp.Pages;
|
namespace BookApp.Pages;
|
||||||
|
|
||||||
public partial class DetailBook : ContentPage
|
public partial class DetailBook : ContentPage
|
||||||
{
|
{
|
||||||
/*private int maxStars = 5;
|
public DetailBook(ViewModelManager data)
|
||||||
private int currentRating = 0;
|
|
||||||
|
|
||||||
public Book BookDetail { get; set; }
|
|
||||||
*/
|
|
||||||
public DetailBook(Model.Book selectedItem) //Book ItemBook)
|
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
BindingContext = data;
|
||||||
/* for (int i = 1; i <= maxStars; i++)
|
|
||||||
{
|
|
||||||
var star = new Image
|
|
||||||
{
|
|
||||||
Source = "empty_star.svg", // image d'une étoile vide
|
|
||||||
WidthRequest = 25,
|
|
||||||
HeightRequest = 25
|
|
||||||
};
|
|
||||||
|
|
||||||
int currentStar = i;
|
|
||||||
|
|
||||||
star.GestureRecognizers.Add(
|
|
||||||
new TapGestureRecognizer { Command = new Command(() => StarTapped(currentStar)), }
|
|
||||||
);
|
|
||||||
StarLayout.Children.Add(star);
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateStars();
|
|
||||||
BookDetail = ItemBook;
|
|
||||||
BindingContext = this;*/
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
private void StarTapped(int rating)
|
|
||||||
{
|
|
||||||
if (rating > maxStars)
|
|
||||||
{
|
|
||||||
System.Diagnostics.Debug.WriteLine("Erreur : rating trop élevé!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentRating = rating;
|
|
||||||
UpdateStars();
|
|
||||||
RatingLabel.Text = $"Note: {currentRating}/{maxStars}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateStars()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < maxStars; i++)
|
|
||||||
{
|
|
||||||
var star = (Image)StarLayout.Children[i];
|
|
||||||
if (i < currentRating)
|
|
||||||
star.Source = "filled_star.svg"; // image d'une étoile remplie
|
|
||||||
else
|
|
||||||
star.Source = "empty_star.svg";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async void BackButton(object sender, EventArgs args)
|
|
||||||
{
|
|
||||||
await Shell.Current.Navigation.PopAsync();
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,33 @@
|
|||||||
|
using BookApp.ViewModel;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace BookApp.Pages;
|
namespace BookApp.Pages
|
||||||
|
|
||||||
public partial class EmpruntsPrets : ContentPage
|
|
||||||
{
|
{
|
||||||
public ICommand TapCommand => new Command(ToggleSwitch);
|
public partial class EmpruntsPrets : ContentPage
|
||||||
|
{
|
||||||
|
/* public ICommand TapCommand => new Command(ToggleSwitch);
|
||||||
|
|
||||||
private bool _isToggled;
|
private bool _isToggled;
|
||||||
|
|
||||||
public bool IsToggled
|
public bool IsToggled
|
||||||
{
|
{
|
||||||
get => _isToggled;
|
get => _isToggled;
|
||||||
set
|
set
|
||||||
|
{
|
||||||
|
_isToggled = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public EmpruntsPrets(ViewModelManager data)
|
||||||
{
|
{
|
||||||
_isToggled = value;
|
InitializeComponent();
|
||||||
OnPropertyChanged();
|
BindingContext = data;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public EmpruntsPrets()
|
/*private void ToggleSwitch()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
IsToggled = !IsToggled;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
async void BackButton(object sender, EventArgs args)
|
|
||||||
{
|
|
||||||
await Shell.Current.Navigation.PopAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ToggleSwitch()
|
|
||||||
{
|
|
||||||
IsToggled = !IsToggled;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue