Merge pull request 'Mathéo' (#29) from Mathéo into master
continuous-integration/drone/push Build is failing Details

Reviewed-on: #29
pull/37/head
Matheo HERSAN 2 years ago
commit eed8d15ae5

@ -32,7 +32,7 @@
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<MauiIcon Include="Resources\AppIcon\logo.png"/>
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
@ -58,12 +58,17 @@
</ItemGroup>
<ItemGroup>
<None Remove="Resources\AppIcon\logo.png" />
<None Remove="Resources\Images\account_circle.png" />
<None Remove="Resources\Images\Evangelion.jpg" />
<None Remove="Resources\Images\logo.png" />
<None Remove="Resources\Images\settings.png" />
</ItemGroup>
<ItemGroup>
<MauiImage Include="Resources\AppIcon\logo.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
</ItemGroup>

@ -1,18 +1,42 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using MangaMap.DataBinding;
using MangaMap.Stub;
namespace MangaMap.Model
{
public class Manager
public class Manager : System.ComponentModel.INotifyPropertyChanged
{
public IPersistanceManager Persistance { get; set; }
public List<Admin> Admins { get; private set; }
public List<Utilisateur> Utilisateurs { get; private set; }
public List<Oeuvre> Oeuvres { get; private set; }
private ObservableCollection<Oeuvre> oeuvres;
public ObservableCollection<Oeuvre> Oeuvres
{
get
{
return oeuvres;
}
set
{
oeuvres = value;
OnPropertyChanged();
}
}
public event PropertyChangedEventHandler? PropertyChanged;
void OnPropertyChanged([CallerMemberName] string propertyName = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public Utilisateur UtilisateurActuel { get; set; }
public bool isAdmin { get; set; }
@ -20,7 +44,7 @@ namespace MangaMap.Model
public Manager(IPersistanceManager Pers) {
Admins = new List<Admin>();
Utilisateurs = new List<Utilisateur>();
Oeuvres = new List<Oeuvre>();
Oeuvres = new ObservableCollection<Oeuvre>();
UtilisateurActuel = new Utilisateur();
isAdmin = false;
@ -31,7 +55,7 @@ namespace MangaMap.Model
{
Admins = new List<Admin>();
Utilisateurs = new List<Utilisateur>();
Oeuvres = new List<Oeuvre>();
Oeuvres = new ObservableCollection<Oeuvre>();
UtilisateurActuel = new Utilisateur();
isAdmin = false;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

@ -1,6 +1,7 @@
using MangaMap.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Runtime.Serialization;
@ -16,7 +17,7 @@ namespace MangaMap.Stub
public string FileName { get; set; } = "SauvegardeDonnees.xml";
public string FilePath { get; set; } = Path.Combine(AppDomain.CurrentDomain.BaseDirectory);
public (List<Oeuvre>, List<Utilisateur>) chargeDonne()
public (ObservableCollection<Oeuvre>, List<Utilisateur>) chargeDonne()
{
var serializer = new DataContractSerializer(typeof(DataToPersist));
DataToPersist data;
@ -36,7 +37,7 @@ namespace MangaMap.Stub
return (data.Oeuvres, data.Utilisateurs);
}
public void sauvegarder(List<Oeuvre> o, List<Utilisateur> u)
public void sauvegarder(ObservableCollection<Oeuvre> o, List<Utilisateur> u)
{
var serializer = new DataContractSerializer(typeof(DataToPersist));

@ -4,13 +4,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
namespace MangaMap.Stub
{
//Cette classe permet de définir ce qui doit être enregistrer par la persistance.
public class DataToPersist
{
public List<Oeuvre> Oeuvres { get; set; } = new List<Oeuvre>();
public ObservableCollection<Oeuvre> Oeuvres { get; set; } = new ObservableCollection<Oeuvre>();
public List<Utilisateur> Utilisateurs { get; set; } = new List<Utilisateur>();
}

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -9,8 +10,8 @@ namespace MangaMap.Stub
{
public interface IPersistanceManager
{
(List<Oeuvre>, List<Utilisateur>) chargeDonne();
(ObservableCollection<Oeuvre>, List<Utilisateur>) chargeDonne();
void sauvegarder(List<Oeuvre> o, List<Utilisateur> u);
void sauvegarder(ObservableCollection<Oeuvre> o, List<Utilisateur> u);
}
}

@ -1,6 +1,7 @@
using MangaMap.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -12,9 +13,9 @@ namespace MangaMap.Stub
//Cette classe sert à faire charger un jeu de données qui n'est pas celui enregistrer dans le fichier sur l'ordinateur.
//Il permet de faire des transistion entre différent moyen de persister.
{
public (List<Oeuvre>, List<Utilisateur>) chargeDonne()
public (ObservableCollection<Oeuvre>, List<Utilisateur>) chargeDonne()
{
List<Oeuvre> l1 = new List<Oeuvre>();
ObservableCollection<Oeuvre> l1 = new ObservableCollection<Oeuvre>();
List<Utilisateur> l2 = new List<Utilisateur>();
Utilisateur u1 = new Utilisateur("t", "Pseudo1", "t", "Jean", "Baptiste", 12);
@ -34,7 +35,7 @@ namespace MangaMap.Stub
return (l1, l2);
}
public void sauvegarder(List<Oeuvre> o, List<Utilisateur> u)
public void sauvegarder(ObservableCollection<Oeuvre> o, List<Utilisateur> u)
{
throw new NotImplementedException();
}

@ -73,7 +73,7 @@
<Grid Margin="20,0,20,20" ColumnDefinitions="*,*,300,300">
<ImageButton Grid.Column="0" Source="{Binding Affiche}" Style="{StaticResource ImageAnime}" HorizontalOptions="Start" Clicked="AnimeImageClickedList"/>
<Label Grid.Column="1" Text="{Binding Nom}" TextColor="White" FontSize="Medium" VerticalOptions="Center" Margin="15"/>
<Label Grid.Column="2" Text="4/5" TextColor="White" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="Center"/>
<Label Grid.Column="2" Text="{Binding Note}" TextColor="White" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="Center"/>
<Label Grid.Column="3" Text="{Binding NbEpisodes}" TextColor="White" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="End"/>
</Grid>
</DataTemplate>
@ -112,7 +112,7 @@
<Grid Margin="20,0,20,20" ColumnDefinitions="*,*,300,300">
<ImageButton Grid.Column="0" Source="{Binding Affiche}" Style="{StaticResource ImageAnime}" HorizontalOptions="Start" Clicked="AnimeImageClickedList"/>
<Label Grid.Column="1" Text="{Binding Nom}" TextColor="White" FontSize="Medium" VerticalOptions="Center" Margin="15"/>
<Label Grid.Column="2" Text="4/5" TextColor="White" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="Center"/>
<Label Grid.Column="2" Text="{Binding Note}" TextColor="White" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="Center"/>
<Label Grid.Column="3" Text="{Binding NbEpisodes}" TextColor="White" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="End"/>
</Grid>
</DataTemplate>
@ -151,7 +151,7 @@
<Grid Margin="20,0,20,20" ColumnDefinitions="*,*,300,300">
<ImageButton Grid.Column="0" Source="{Binding Affiche}" Style="{StaticResource ImageAnime}" HorizontalOptions="Start" Clicked="AnimeImageClickedList"/>
<Label Grid.Column="1" Text="{Binding Nom}" TextColor="White" FontSize="Medium" VerticalOptions="Center" Margin="15"/>
<Label Grid.Column="2" Text="4/5" TextColor="White" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="Center"/>
<Label Grid.Column="2" Text="{Binding Note}" TextColor="White" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="Center"/>
<Label Grid.Column="2" Text="{Binding NbEpisodesVus}" TextColor="White" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="End"/>
</Grid>
</DataTemplate>

@ -6,6 +6,7 @@ using System.Diagnostics;
using System.Drawing;
using System.Windows.Input;
using System.Xml.Linq;
using Microsoft.Maui.Graphics;
public partial class ficheAnime : ContentPage, INotifyPropertyChanged
@ -91,6 +92,7 @@ public partial class ficheAnime : ContentPage, INotifyPropertyChanged
ImageButton imageButton = new ImageButton
{
Source = "star_full.png",
BackgroundColor = Microsoft.Maui.Graphics.Color.FromHex("1E1E1E"),
WidthRequest = 50,
HeightRequest = 50,
AutomationId = i.ToString(),
@ -108,6 +110,7 @@ public partial class ficheAnime : ContentPage, INotifyPropertyChanged
ImageButton imageButton = new ImageButton
{
Source = "star_empty.png",
BackgroundColor = Microsoft.Maui.Graphics.Color.FromHex("1E1E1E"),
WidthRequest = 50,
HeightRequest = 50,
AutomationId = i.ToString(),

@ -11,21 +11,22 @@
<modeles:Manager/>
</ContentPage.BindingContext>
<Grid RowDefinitions="40, *">
<Grid RowDefinitions="40, *" >
<local:NewContent1 HeightRequest="40" VerticalOptions="Start" Padding="10, 0"/>
<ScrollView
<ScrollView
BackgroundColor="#1E1E1E"
Grid.Row="1">
<VerticalStackLayout
VerticalOptions="Center">
<SearchBar Placeholder="Recherche"
CancelButtonColor="Orange"
TextColor="Black"
BackgroundColor="White"
HorizontalTextAlignment="Center"
Margin="30"
<SearchBar
Placeholder="Recherche"
TextChanged="OnTextChanged"
TextColor="Black"
BackgroundColor="White"
HorizontalTextAlignment="Center"
Margin="30"
/>
<!--<HorizontalStackLayout BindableLayout.ItemsSource="{Binding Oeuvres}" Spacing="100" HorizontalOptions="Center">
@ -37,13 +38,33 @@
Source="{Binding Affiche}"
Clicked="AnimeImageClicked"
/>
--><!--<views:StyleBouton --><!--
<views:StyleBouton/>
</DataTemplate>
</BindableLayout.ItemTemplate>
</HorizontalStackLayout>-->
<ScrollView>
<CollectionView ItemsSource="{Binding Oeuvre}" VerticalScrollBarVisibility="Always" x:Name="searchResults">
<CollectionView.ItemTemplate>
<DataTemplate>
<ImageButton
Style="{StaticResource ImageAnime}"
BackgroundColor="Red"
Source="{Binding Affiche}"
Clicked="AnimeImageClicked"
/>
</DataTemplate>
</CollectionView.ItemTemplate>
<CollectionView.ItemsLayout>
<GridItemsLayout Span="4" Orientation="Vertical" VerticalItemSpacing="30" HorizontalItemSpacing="15"/>
</CollectionView.ItemsLayout>
</CollectionView>
</ScrollView>
<ScrollView>
<!--<ScrollView >
<Grid x:Name="grille">
<Grid.RowDefinitions>
<RowDefinition/>
@ -60,7 +81,9 @@
<ColumnDefinition/>
</Grid.ColumnDefinitions>
</Grid>
</ScrollView>
</ScrollView>-->
<!--<ListView x:Name="a1" ItemsSource="{Binding Utilisateurs}">

@ -1,7 +1,7 @@
namespace MangaMap.Views;
using MangaMap.Model;
using System.Collections.ObjectModel;
public partial class homePage : ContentPage
{
@ -11,28 +11,29 @@ public partial class homePage : ContentPage
{
InitializeComponent();
BindingContext = my_manager;
chargerSerie();
searchResults.ItemsSource = my_manager.Oeuvres;
//chargerSerie();
}
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));
//}
var button = (ImageButton)sender;
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));
}
/*var button = (ImageButton)sender;
var idAutomation = button.AutomationId;
if (int.TryParse(idAutomation, out int id))
{
await Navigation.PushAsync(new ficheAnime(my_manager.Oeuvres[id]));
}
}*/
}
private void chargerSerie()
/*private void chargerSerie()
{
int imagesParLigne = 4;
int indice = 0;
@ -65,6 +66,19 @@ public partial class homePage : ContentPage
indice++;
}
}*/
private void OnTextChanged(object sender, TextChangedEventArgs e)
{
if(string.IsNullOrWhiteSpace(e.NewTextValue))
{
searchResults.ItemsSource = my_manager.Oeuvres;
}
else
{
searchResults.ItemsSource = my_manager.Oeuvres.Where(i => i.Nom.ToLower().Contains(e.NewTextValue.ToLower()));
}
}
}

Loading…
Cancel
Save