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;
|
||||
|
||||
namespace BookApp.Pages;
|
||||
|
||||
public partial class DetailBook : ContentPage
|
||||
{
|
||||
/*private int maxStars = 5;
|
||||
private int currentRating = 0;
|
||||
|
||||
public Book BookDetail { get; set; }
|
||||
*/
|
||||
public DetailBook(Model.Book selectedItem) //Book ItemBook)
|
||||
public DetailBook(ViewModelManager data)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
/* 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}";
|
||||
BindingContext = data;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
namespace BookApp.Pages;
|
||||
|
||||
public partial class EmpruntsPrets : ContentPage
|
||||
namespace BookApp.Pages
|
||||
{
|
||||
public ICommand TapCommand => new Command(ToggleSwitch);
|
||||
|
||||
private bool _isToggled;
|
||||
|
||||
public bool IsToggled
|
||||
public partial class EmpruntsPrets : ContentPage
|
||||
{
|
||||
get => _isToggled;
|
||||
set
|
||||
/* public ICommand TapCommand => new Command(ToggleSwitch);
|
||||
|
||||
private bool _isToggled;
|
||||
|
||||
public bool IsToggled
|
||||
{
|
||||
get => _isToggled;
|
||||
set
|
||||
{
|
||||
_isToggled = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}*/
|
||||
|
||||
public EmpruntsPrets(ViewModelManager data)
|
||||
{
|
||||
_isToggled = value;
|
||||
OnPropertyChanged();
|
||||
InitializeComponent();
|
||||
BindingContext = data;
|
||||
}
|
||||
}
|
||||
|
||||
public EmpruntsPrets()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
async void BackButton(object sender, EventArgs args)
|
||||
{
|
||||
await Shell.Current.Navigation.PopAsync();
|
||||
}
|
||||
|
||||
private void ToggleSwitch()
|
||||
{
|
||||
IsToggled = !IsToggled;
|
||||
/*private void ToggleSwitch()
|
||||
{
|
||||
IsToggled = !IsToggled;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue