parent
d683ae38ce
commit
dccbbbf8a0
@ -1,46 +1,61 @@
|
||||
using LivreLand.ViewModel;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace LivreLand.View.ContentViews;
|
||||
|
||||
public partial class EmpruntsPretsButtonView : ContentView
|
||||
{
|
||||
public EmpruntsPretsButtonView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
#region Properties
|
||||
|
||||
public void OnPretsClicked(object sender, EventArgs e)
|
||||
{
|
||||
if (App.Current.PlatformAppTheme == AppTheme.Light)
|
||||
{
|
||||
pretsClicked.BackgroundColor = Colors.Transparent;
|
||||
pretsClicked.IsEnabled = false;
|
||||
empruntsButton.BackgroundColor = Colors.White;
|
||||
empruntsButton.IsEnabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
pretsClicked.BackgroundColor = Colors.Transparent;
|
||||
pretsClicked.IsEnabled = false;
|
||||
empruntsButton.BackgroundColor = Colors.Black;
|
||||
empruntsButton.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
public static readonly BindableProperty PretButtonBackgroundColorProperty = BindableProperty.Create(nameof(PretButtonBackgroundColor), typeof(Color), typeof(EmpruntsPretsButtonView));
|
||||
public Color PretButtonBackgroundColor
|
||||
{
|
||||
get => (Color)GetValue(EmpruntsPretsButtonView.PretButtonBackgroundColorProperty);
|
||||
set => SetValue(EmpruntsPretsButtonView.PretButtonBackgroundColorProperty, value);
|
||||
}
|
||||
|
||||
public static readonly BindableProperty PretButtonIsEnabledProperty = BindableProperty.Create(nameof(PretButtonIsEnabled), typeof(bool), typeof(EmpruntsPretsButtonView));
|
||||
public bool PretButtonIsEnabled
|
||||
{
|
||||
get => (bool)GetValue(EmpruntsPretsButtonView.PretButtonIsEnabledProperty);
|
||||
set => SetValue(EmpruntsPretsButtonView.PretButtonIsEnabledProperty, value);
|
||||
}
|
||||
|
||||
public void OnEmpruntsClicked(object sender, EventArgs e)
|
||||
public static readonly BindableProperty PretsButtonCommandProperty = BindableProperty.Create(nameof(PretsButtonCommand), typeof(ICommand), typeof(EmpruntsPretsButtonView));
|
||||
public ICommand PretsButtonCommand
|
||||
{
|
||||
if (App.Current.PlatformAppTheme == AppTheme.Light)
|
||||
{
|
||||
pretsClicked.BackgroundColor = Colors.White;
|
||||
pretsClicked.IsEnabled = true;
|
||||
empruntsButton.BackgroundColor = Colors.Transparent;
|
||||
empruntsButton.IsEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
pretsClicked.BackgroundColor = Colors.Black;
|
||||
pretsClicked.IsEnabled = true;
|
||||
empruntsButton.BackgroundColor = Colors.Transparent;
|
||||
empruntsButton.IsEnabled = false;
|
||||
}
|
||||
get { return (ICommand)GetValue(PretsButtonCommandProperty); }
|
||||
set { SetValue(PretsButtonCommandProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly BindableProperty EmpruntButtonBackgroundColorProperty = BindableProperty.Create(nameof(EmpruntButtonBackgroundColor), typeof(Color), typeof(EmpruntsPretsButtonView));
|
||||
public Color EmpruntButtonBackgroundColor
|
||||
{
|
||||
get => (Color)GetValue(EmpruntsPretsButtonView.EmpruntButtonBackgroundColorProperty);
|
||||
set => SetValue(EmpruntsPretsButtonView.EmpruntButtonBackgroundColorProperty, value);
|
||||
}
|
||||
|
||||
public static readonly BindableProperty EmpruntButtonIsEnabledProperty = BindableProperty.Create(nameof(EmpruntButtonIsEnabled), typeof(bool), typeof(EmpruntsPretsButtonView));
|
||||
public bool EmpruntButtonIsEnabled
|
||||
{
|
||||
get => (bool)GetValue(EmpruntsPretsButtonView.EmpruntButtonIsEnabledProperty);
|
||||
set => SetValue(EmpruntsPretsButtonView.EmpruntButtonIsEnabledProperty, value);
|
||||
}
|
||||
|
||||
public static readonly BindableProperty EmpruntsButtonCommandProperty = BindableProperty.Create(nameof(EmpruntsButtonCommand), typeof(ICommand), typeof(EmpruntsPretsButtonView));
|
||||
public ICommand EmpruntsButtonCommand
|
||||
{
|
||||
get { return (ICommand)GetValue(EmpruntsButtonCommandProperty); }
|
||||
set { SetValue(EmpruntsButtonCommandProperty, value); }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public EmpruntsPretsButtonView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
@ -1,27 +1,41 @@
|
||||
using LivreLand.Model;
|
||||
using LivreLand.ViewModel;
|
||||
|
||||
namespace LivreLand.View;
|
||||
|
||||
public partial class EmpruntsPretsView : ContentPage
|
||||
{
|
||||
public List<BookModel> AntoineBooks { get; set; } = new List<BookModel>()
|
||||
{
|
||||
new BookModel("The Wake","Scott Snyder","Terminé", 0),
|
||||
};
|
||||
#region Properties
|
||||
|
||||
public List<BookModel> AudreyPoucletBooks { get; set; } = new List<BookModel>()
|
||||
{
|
||||
new BookModel("Les feux de Cibola","James S. A. Corey","Terminé", 0),
|
||||
};
|
||||
public EmpruntsPretsVM EmpruntsPretsVM { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
public EmpruntsPretsView()
|
||||
public EmpruntsPretsView(EmpruntsPretsVM empruntsPretsVM)
|
||||
{
|
||||
BindingContext = this;
|
||||
EmpruntsPretsVM = empruntsPretsVM;
|
||||
InitializeComponent();
|
||||
BindingContext = this;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
//App.Current.MainPage.Navigation.PushAsync(new DetailsLivreView());
|
||||
}
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
|
||||
EmpruntsPretsVM.Manager.GetCurrentLoansCommand.Execute(null);
|
||||
EmpruntsPretsVM.Manager.GetCurrentBorrowingsCommand.Execute(null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
Loading…
Reference in new issue