FIX : Emprunts Prets Button Fonctionnel

commands-19-09
Lou BRODA 1 year ago
parent 81ace28547
commit 346256b1fc

@ -27,6 +27,8 @@
<RowDefinition Height="40"/> <RowDefinition Height="40"/>
<RowDefinition Height="10"/> <RowDefinition Height="10"/>
<RowDefinition Height="auto"/> <RowDefinition Height="auto"/>
<RowDefinition Height="10"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid BackgroundColor="{AppThemeBinding Light={StaticResource HeaderGray}, Dark={StaticResource Gray900}}" <Grid BackgroundColor="{AppThemeBinding Light={StaticResource HeaderGray}, Dark={StaticResource Gray900}}"
Grid.Row="0"> Grid.Row="0">
@ -41,12 +43,41 @@
Style="{StaticResource HeaderCollectionViewText}" Style="{StaticResource HeaderCollectionViewText}"
Grid.Column="1"/> Grid.Column="1"/>
</Grid> </Grid>
<Grid HorizontalOptions="Center"
Grid.Column="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<HorizontalStackLayout Spacing="10"
Grid.Column="0">
<Image Source="plus.png"/>
<Label Text="Add new contact"/>
</HorizontalStackLayout>
<!--<VerticalStackLayout IsVisible=""
Grid.Column="2">
<Grid FlowDirection="LeftToRight">
<Label Text="Prénom :" />
<Entry Placeholder="Saisissez le prénom"/>
<Label Text="Nom :"/>
<Entry Placeholder="Saisissez le nom"/>
<Button Text="Enregistrer"
Command="{Binding ContactsVM.Navigator.AddContactCommand}"/>
</Grid>
</VerticalStackLayout>
<Grid.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ContactsVM.}"/>
</Grid.GestureRecognizers>-->
</Grid>
<CollectionView ItemsSource="{Binding ContactsVM.Manager.AllContacts}" <CollectionView ItemsSource="{Binding ContactsVM.Manager.AllContacts}"
SelectedItem="{Binding ContactsVM.Manager.SelectedContact}" SelectedItem="{Binding ContactsVM.Manager.SelectedContact}"
SelectionChangedCommand="{Binding ContactsVM.Manager.LendBookCommand}" SelectionChangedCommand="{Binding ContactsVM.Manager.LendBookCommand}"
SelectionChangedCommandParameter="{Binding ContactsVM.Manager.SelectedContact}" SelectionChangedCommandParameter="{Binding ContactsVM.Manager.SelectedContact}"
SelectionMode="Single" SelectionMode="Single"
Grid.Row="2"> Grid.Row="4">
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate x:DataType="viewModel:ContactVM"> <DataTemplate x:DataType="viewModel:ContactVM">
<VerticalStackLayout> <VerticalStackLayout>

@ -30,38 +30,80 @@ namespace LivreLand.ViewModel
public Color PretButtonBackgroundColor public Color PretButtonBackgroundColor
{ {
get => pretButtonBackgroundColor; get { return pretButtonBackgroundColor; }
set => pretButtonBackgroundColor = value; set
{
if (pretButtonBackgroundColor != value)
{
pretButtonBackgroundColor = value;
OnPropertyChanged(nameof(PretButtonBackgroundColor));
}
}
} }
public bool PretButtonIsEnabled public bool PretButtonIsEnabled
{ {
get => pretButtonIsEnabled; get { return pretButtonIsEnabled; }
set => pretButtonIsEnabled = value; set
{
if (pretButtonIsEnabled != value)
{
pretButtonIsEnabled = value;
OnPropertyChanged(nameof(PretButtonIsEnabled));
}
}
} }
public Color EmpruntButtonBackgroundColor public Color EmpruntButtonBackgroundColor
{ {
get => empruntButtonBackgroundColor; get { return empruntButtonBackgroundColor; }
set => empruntButtonBackgroundColor = value; set
{
if (empruntButtonBackgroundColor != value)
{
empruntButtonBackgroundColor = value;
OnPropertyChanged(nameof(EmpruntButtonBackgroundColor));
}
}
} }
public bool EmpruntButtonIsEnabled public bool EmpruntButtonIsEnabled
{ {
get => empruntButtonIsEnabled; get { return empruntButtonIsEnabled; }
set => empruntButtonIsEnabled = value; set
{
if (empruntButtonIsEnabled != value)
{
empruntButtonIsEnabled = value;
OnPropertyChanged(nameof(EmpruntButtonIsEnabled));
}
}
} }
public bool EmpruntCollectionIsVisible public bool EmpruntCollectionIsVisible
{ {
get => empruntCollectionIsVisible; get { return empruntCollectionIsVisible; }
set => empruntCollectionIsVisible = value; set
{
if (empruntCollectionIsVisible != value)
{
empruntCollectionIsVisible = value;
OnPropertyChanged(nameof(EmpruntCollectionIsVisible));
}
}
} }
public bool PretCollectionIsVisible public bool PretCollectionIsVisible
{ {
get => pretCollectionIsVisible; get { return pretCollectionIsVisible; }
set => pretCollectionIsVisible = value; set
{
if (pretCollectionIsVisible != value)
{
pretCollectionIsVisible = value;
OnPropertyChanged(nameof(PretCollectionIsVisible));
}
}
} }
public ICommand PretsButtonCommand { get; private set; } public ICommand PretsButtonCommand { get; private set; }
@ -88,40 +130,40 @@ namespace LivreLand.ViewModel
{ {
if (App.Current.PlatformAppTheme == AppTheme.Light) if (App.Current.PlatformAppTheme == AppTheme.Light)
{ {
pretButtonBackgroundColor = Colors.Transparent; PretButtonBackgroundColor = Colors.Transparent;
pretButtonIsEnabled = false; PretButtonIsEnabled = false;
empruntButtonBackgroundColor = Colors.White; EmpruntButtonBackgroundColor = Colors.White;
empruntButtonIsEnabled = true; EmpruntButtonIsEnabled = true;
} }
else else
{ {
pretButtonBackgroundColor = Colors.Transparent; PretButtonBackgroundColor = Colors.Transparent;
pretButtonIsEnabled = false; PretButtonIsEnabled = false;
empruntButtonBackgroundColor = Colors.Black; EmpruntButtonBackgroundColor = Colors.Black;
empruntButtonIsEnabled = true; EmpruntButtonIsEnabled = true;
} }
pretCollectionIsVisible = false; PretCollectionIsVisible = false;
empruntCollectionIsVisible = true; EmpruntCollectionIsVisible = true;
} }
public void EmpruntsButtonClicked() public void EmpruntsButtonClicked()
{ {
if (App.Current.PlatformAppTheme == AppTheme.Light) if (App.Current.PlatformAppTheme == AppTheme.Light)
{ {
pretButtonBackgroundColor = Colors.White; PretButtonBackgroundColor = Colors.White;
pretButtonIsEnabled = true; PretButtonIsEnabled = true;
empruntButtonBackgroundColor = Colors.Transparent; EmpruntButtonBackgroundColor = Colors.Transparent;
empruntButtonIsEnabled = false; EmpruntButtonIsEnabled = false;
} }
else else
{ {
pretButtonBackgroundColor = Colors.Black; PretButtonBackgroundColor = Colors.Black;
pretButtonIsEnabled = true; PretButtonIsEnabled = true;
empruntButtonBackgroundColor = Colors.Transparent; EmpruntButtonBackgroundColor = Colors.Transparent;
empruntButtonIsEnabled = false; EmpruntButtonIsEnabled = false;
} }
pretCollectionIsVisible = true; PretCollectionIsVisible = true;
empruntCollectionIsVisible = false; EmpruntCollectionIsVisible = false;
} }
#endregion #endregion

Loading…
Cancel
Save