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