Merge branch 'DataBinding'
continuous-integration/drone/push Build is failing Details

DataBinding
Vianney JOURDY 2 years ago
commit 4d65c29596

@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MangaMap.NewContent1"
Background="{StaticResource Primary}">
<Grid ColumnDefinitions="50, *, 30">
<Grid ColumnDefinitions="50, *, 40">
<ImageButton Source="logo.png"
MaximumHeightRequest="30"
MaximumWidthRequest="30"

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MangaMap.DataBinding
{
public interface INotifyPropertyChanged
{
}
}

@ -58,9 +58,9 @@
</ItemGroup>
<ItemGroup>
<None Remove="Resources\Images\Evangelion.jpg" />
<None Remove="Resources\Images\logo.png" />
<None Remove="Resources\Images\settings.png" />
<None Remove="Resources\Images\test.jpg" />
</ItemGroup>
<ItemGroup>

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 101 KiB

Before

Width:  |  Height:  |  Size: 573 KiB

After

Width:  |  Height:  |  Size: 573 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

@ -0,0 +1,3 @@
<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M51.5995 80.3367L50 79.3286L48.4005 80.3367L22.2873 96.7941L22.2659 96.8076L22.2446 96.8215C21.9992 96.9821 21.8349 97.0077 21.6743 96.9984C21.3995 96.9824 21.2189 96.9085 21.0502 96.7824C20.8413 96.6262 20.6768 96.4268 20.5477 96.1179C20.486 95.9704 20.4227 95.7098 20.5093 95.2285L27.3779 64.1254L27.7519 62.4318L26.4707 61.2626L3.45013 40.2535C3.44969 40.2531 3.44925 40.2527 3.44882 40.2523C3.09118 39.9244 3.05657 39.7374 3.0485 39.6896C2.97181 39.2347 2.98924 38.8339 3.07836 38.4608C3.1053 38.348 3.15083 38.2442 3.32949 38.0972C3.4795 37.9739 3.69984 37.8554 4.10721 37.8104L34.5497 35.0206L36.3769 34.8532L37.0602 33.1504L48.8398 3.79549C48.9872 3.45789 49.1405 3.3261 49.2757 3.24647C49.6382 3.03307 49.8673 3 50 3C50.1327 3 50.3618 3.03307 50.7243 3.24647C50.8595 3.32611 51.0128 3.45791 51.1602 3.79559L62.9398 33.1504L63.6231 34.8532L65.4502 35.0206L95.8928 37.8104C96.3002 37.8554 96.5205 37.9739 96.6705 38.0972C96.8492 38.2442 96.8947 38.348 96.9216 38.4608C97.0108 38.8339 97.0282 39.2347 96.9515 39.6896C96.9434 39.7375 96.9088 39.9248 96.5502 40.2533C96.5501 40.2533 96.55 40.2534 96.5499 40.2535L73.5293 61.2626L72.2481 62.4318L72.6221 64.1254L79.4907 95.2285C79.5774 95.7098 79.514 95.9704 79.4523 96.1179C79.3232 96.4268 79.1587 96.6262 78.9498 96.7824C78.7811 96.9085 78.6005 96.9824 78.3257 96.9984C78.1651 97.0077 78.0008 96.9821 77.7554 96.8215L77.7341 96.8076L77.7127 96.7941L51.5995 80.3367Z" stroke="#FFD600" stroke-width="6"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -0,0 +1,3 @@
<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M50 82.8747L23.8869 99.3321C23.1381 99.8219 22.3426 100.042 21.5002 99.9933C20.6578 99.9443 19.9091 99.6749 19.2539 99.1851C18.5987 98.6953 18.1074 98.0586 17.7798 97.2749C17.4522 96.4912 17.382 95.6096 17.5692 94.63L24.4485 63.4785L1.42399 42.4659C0.675224 41.7802 0.230646 41.021 0.0902527 40.1883C-0.0501404 39.3557 -0.0267415 38.5475 0.160449 37.7638C0.34764 36.9801 0.768819 36.3189 1.42399 35.7801C2.07916 35.2413 2.87472 34.923 3.81067 34.825L34.276 32.0331L46.069 2.64494C46.4434 1.76329 47.0049 1.10206 47.7537 0.661234C48.5025 0.220411 49.2512 0 50 0C50.7488 0 51.4975 0.220411 52.2463 0.661234C52.9951 1.10206 53.5566 1.76329 53.931 2.64494L65.724 32.0331L96.1893 34.825C97.1253 34.923 97.9209 35.2413 98.576 35.7801C99.2312 36.3189 99.6524 36.9801 99.8396 37.7638C100.027 38.5475 100.05 39.3557 99.9098 40.1883C99.7694 41.021 99.3248 41.7802 98.576 42.4659L75.5516 63.4785L82.4308 94.63C82.618 95.6096 82.5478 96.4912 82.2202 97.2749C81.8926 98.0586 81.4013 98.6953 80.7461 99.1851C80.0909 99.6749 79.3422 99.9443 78.4998 99.9933C77.6574 100.042 76.8619 99.8219 76.1131 99.3321L50 82.8747Z" fill="#FFD600"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -23,8 +23,8 @@ namespace MangaMap.Stub
List<string> genres = new List<string>();
genres.Add("Action");
genres.Add("Future");
Oeuvre o1 = new Oeuvre("test", genres, "TV", "C'est une bonne série", 4, 150, "test.jpg");
Oeuvre o2 = new Oeuvre("test2", genres, "DVD", "A la fin il meurt", 2, 24, "test2.png");
Oeuvre o1 = new Oeuvre("Evangelion", genres, "TV", "C'est une bonne série", 4, 150, "evangelion.jpg");
Oeuvre o2 = new Oeuvre("[Oshi No Ko]", genres, "DVD", "A la fin il meurt", 2, 24, "oshinoko.png");
l1.Add(o1); l1.Add(o2);
l2.Add(u1); l2.Add(u2); l2.Add(u3);

@ -1,18 +1,48 @@
namespace MangaMap.Views;
using Model;
using System.ComponentModel;
using System.Xml.Linq;
public partial class ficheAnime : ContentPage
public partial class ficheAnime : ContentPage, INotifyPropertyChanged
{
public Manager DataManager { get; set; }
public Oeuvre AnimeModel { get; set; }
public ficheAnime()
{
InitializeComponent();
// Exemple de création d'une instance de la classe Oeuvre
List<string> genres = new List<string>() { "Action", "Aventure" };
AnimeModel = new Oeuvre("Nom de l'oeuvre", genres, "Type de l'oeuvre", "Description de l'oeuvre", 5, 12, "Chemin/vers/l'affiche.png");
this.BindingContext = this;
}
public ficheAnime(Oeuvre anime)
{
AnimeModel = anime;
InitializeComponent();
this.BindingContext = this;
}
private void SetNote(float note)
{
note = (int)note; // Tronquer à un entier car nous ne gérons actuellement pas les demi-étoiles
var starImages = star.Children.OfType<Image>().Reverse().ToList();
foreach (var img in starImages)
{
if (note > 0)
{
img.Opacity = 1;
note--;
}
else
{
img.Opacity = 0;
}
}
}
}

@ -12,14 +12,15 @@
<VerticalStackLayout Grid.Row="1">
<HorizontalStackLayout>
<Rectangle
WidthRequest="150"
HeightRequest="150"
Fill="Red"
HorizontalOptions="Start"
Margin="50"/>
<Label Text="Titre" FontSize="Header" VerticalOptions="Center"/>
<ImageButton
Style="{StaticResource ImageAnime}"
BackgroundColor="Orange"
Margin="50"
Source="{Binding AnimeModel.Affiche}"
/>
<Label Text="{Binding AnimeModel.Nom}" FontSize="Header" VerticalOptions="Center" TextColor="White"/>
</HorizontalStackLayout>
<Grid>
@ -28,25 +29,26 @@
<Label Text="test" BackgroundColor="{StaticResource Primary}"/>
</Grid>
<HorizontalStackLayout>
<Ellipse Fill="Gold" WidthRequest="50" HeightRequest="50" Margin="10"/>
<Ellipse Fill="Gold" WidthRequest="50" HeightRequest="50" Margin="10"/>
<Ellipse Fill="Gold" WidthRequest="50" HeightRequest="50" Margin="10"/>
<Ellipse Fill="Gold" WidthRequest="50" HeightRequest="50" Margin="10"/>
<Ellipse Fill="Gold" WidthRequest="50" HeightRequest="50" Margin="10"/>
<Button Text="Ajouter à la liste"
TextColor="#FFFFFF"
HorizontalOptions="Start"
Margin="20"
BackgroundColor="{StaticResource Primary}"/>
</HorizontalStackLayout>
<HorizontalStackLayout x:Name="star">
<Image Source="star_full.png" WidthRequest="50" HeightRequest="50" Margin="10"/>
<Image Source="star_full.png" WidthRequest="50" HeightRequest="50" Margin="10"/>
<Image Source="star_full.png" WidthRequest="50" HeightRequest="50" Margin="10"/>
<Image Source="star_full.png" WidthRequest="50" HeightRequest="50" Margin="10"/>
<Image Source="star_full.png" WidthRequest="50" HeightRequest="50" Margin="10"/>
<Button Text="Ajouter à la liste"
TextColor="#FFFFFF"
HorizontalOptions="Start"
Margin="20"
BackgroundColor="{StaticResource Primary}"/>
</HorizontalStackLayout>
<Label
Text="Je suis une description. Je suis une description. Je suis une description. Je suis une description. Je suis une description. Je suis une description. Je suis une description. Je suis une description. Je suis une description. Je suis une description."
Margin="20"/>
<Label Text="{Binding AnimeModel.Nom}" FontSize="Header" VerticalOptions="Center" TextColor="{StaticResource Primary}"/>
<Label Text="{Binding AnimeModel.Description}" Margin="20" TextColor="Wheat"/>
<Entry Text="{Binding AnimeModel.Nom}" Placeholder="Entrez le nom"/>
@ -57,7 +59,6 @@
</VerticalStackLayout>
</Grid>
</ContentPage>

@ -29,80 +29,20 @@
Margin="30"
/>
<ListView x:Name="a2" ItemsSource="{Binding Oeuvres}">
<ListView.ItemTemplate>
<HorizontalStackLayout BindableLayout.ItemsSource="{Binding Oeuvres}" Spacing="100" HorizontalOptions="Center">
<BindableLayout.ItemTemplate>
<DataTemplate>
<ViewCell>
<ImageButton
<ImageButton
Style="{StaticResource ImageAnime}"
BackgroundColor="Red"
Source="{Binding Affiche}"
Clicked="AnimeImageClicked"
/>
</ViewCell>
<!--<views:StyleBouton -->
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<HorizontalStackLayout
Spacing="100"
HorizontalOptions="Center">
<views:StyleBouton/>
<ImageButton
Style="{StaticResource ImageAnime}"
BackgroundColor="Orange"
Source="test.jpg"
/>
<views:StyleBouton/>
<views:StyleBouton/>
</HorizontalStackLayout>
<HorizontalStackLayout
Spacing="100"
HorizontalOptions="Center">
<views:StyleBouton/>
<views:StyleBouton/>
<views:StyleBouton/>
<views:StyleBouton/>
</HorizontalStackLayout>
<HorizontalStackLayout
Spacing="100"
HorizontalOptions="Center">
<views:StyleBouton/>
<views:StyleBouton/>
<views:StyleBouton/>
<views:StyleBouton/>
</BindableLayout.ItemTemplate>
</HorizontalStackLayout>
<HorizontalStackLayout
Spacing="100"
HorizontalOptions="Center">
<views:StyleBouton/>
<views:StyleBouton/>
<views:StyleBouton/>
<views:StyleBouton/>
</HorizontalStackLayout>
<ListView x:Name="a1" ItemsSource="{Binding Utilisateurs}">

@ -2,15 +2,27 @@ namespace MangaMap.Views;
using MangaMap.Model;
public partial class homePage : ContentPage
{
public Manager my_manager => (App.Current as App).MyManager;
public homePage()
{
InitializeComponent();
a1.BindingContext = my_manager;
a2.BindingContext = my_manager;
InitializeComponent();
BindingContext = my_manager;
}
private async void AnimeImageClicked(object sender, EventArgs e)
{
var selectedAnime = (sender as ImageButton)?.BindingContext as Oeuvre;
if (selectedAnime != null)
{
// Naviguez vers la page de la fiche d'anime en passant l'objet sélectionné
await Navigation.PushAsync(new ficheAnime(selectedAnime));
}
}
}

Loading…
Cancel
Save