Merge pull request 'Mathéo (Début bouton épisodes)' (#28) from Mathéo into master
continuous-integration/drone/push Build is failing Details

Reviewed-on: #28
pull/29/head
Matheo HERSAN 2 years ago
commit ccad2c48f8

@ -17,7 +17,8 @@
MaximumHeightRequest="30"
BackgroundColor="{StaticResource Primary}"
VerticalOptions="Center"
Clicked="ListButton_Clicked" />
Clicked="ListButton_Clicked"
IsVisible="{Binding IsUserLoggedIn}" />
<ImageButton Grid.Column="3"
Source="account_circle.png"

@ -1,13 +1,17 @@
using MangaMap.Views;
namespace MangaMap;
using MangaMap.Model;
using System.ComponentModel;
using INotifyPropertyChanged = System.ComponentModel.INotifyPropertyChanged;
public partial class NewContent1 : ContentView
public partial class NewContent1 : ContentView, INotifyPropertyChanged
{
public Manager my_manager => (App.Current as App).MyManager;
public NewContent1()
{
InitializeComponent();
}
}
async void ImageButton_Clicked(System.Object sender, System.EventArgs e)
{
//Navigation.PushAsync(new homePage());

@ -8,12 +8,12 @@ using System.Threading.Tasks;
namespace MangaMap.Model
{
[DataContract]
public class Oeuvre
public class Oeuvre
{
[DataMember]
public string Nom { get; private set; }
[DataMember]
public List <string> Genre { get; private set; }
public List<string> Genre { get; private set; }
[DataMember]
public string Type { get; private set; }
[DataMember]

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

@ -9,8 +9,8 @@ namespace MangaMap.Stub
{
public class Stub : IPersistanceManager
//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.
//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()
{
@ -39,4 +39,4 @@ namespace MangaMap.Stub
throw new NotImplementedException();
}
}
}
}

@ -1,6 +1,9 @@
using System.Text.RegularExpressions;
using MangaMap.Model;
using static System.Runtime.InteropServices.JavaScript.JSType;
using System.Threading.Tasks;
using Microsoft.Maui.Storage;
namespace MangaMap.Views;
@ -13,6 +16,27 @@ public partial class createOeuvre : ContentPage
InitializeComponent();
}
private string imagePath;
async void SelectImageClicked(object sender, EventArgs e)
{
var result = await FilePicker.PickAsync(new PickOptions
{
FileTypes = FilePickerFileType.Images,
PickerTitle = "Pick an image"
});
if (result != null)
{
var stream = await result.OpenReadAsync();
// Utilisez le chemin d'accès à l'image sélectionnée
imagePath = result.FullPath;
// Affichez l'image sélectionnée dans l'interface utilisateur, si nécessaire
}
}
async void AddClicked(object sender, System.EventArgs e)
{
// Récupérer les valeurs des entrées
@ -43,7 +67,7 @@ public partial class createOeuvre : ContentPage
return;
}
Oeuvre oeuv = new Oeuvre(nom, type, description, nbEp, "logo.png");
Oeuvre oeuv = new Oeuvre(nom, type, description, nbEp, imagePath);
my_manager.Oeuvres.Add(oeuv);
my_manager.sauvegarder();
await Navigation.PushAsync(new homePage());

@ -7,6 +7,8 @@
<VerticalStackLayout>
<Label Text="Création d'une nouvelle série" FontSize="Title" Margin="0,0,0,20" TextColor="#ffffff"/>
<Button Text="Sélectionner une image" Clicked="SelectImageClicked" Margin="0,0,0,10"/>
<Entry x:Name="nameEntry" Placeholder="Nom" Margin="0,0,0,10" Style="{StaticResource Champs}"/>
<Entry x:Name="typeEntry" Placeholder="Type" Margin="0,0,0,10" Style="{StaticResource Champs}"/>

@ -46,8 +46,8 @@
<ScrollView>
<Grid x:Name="grille">
<Grid.RowDefinitions >
<RowDefinition Height="85"/>
<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>

@ -20,7 +20,7 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Margin="20" Grid.Row="0" ColumnDefinitions="*,300,300">
<Grid Margin="20" Grid.Row="0" ColumnDefinitions="*,400,300">
<Label Grid.Column="0"
Text="Titre" FontSize="Large" TextColor="White"
HorizontalOptions="Start" VerticalOptions="Center"/>
@ -36,11 +36,12 @@
<VerticalStackLayout BindableLayout.ItemsSource="{Binding UtilisateurActuel.ListeOeuvreEnVisionnage}" Spacing="10">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Grid Margin="20,0,20,20" ColumnDefinitions="*,*,300,300">
<Grid Margin="20,0,20,20" ColumnDefinitions="*,*,300,300,40">
<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="3" Text="{Binding NbEpisodes}" TextColor="White" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="End"/>
<ImageButton Grid.Column="4" Source="addepisodes.png" BackgroundColor="#333333" HorizontalOptions="End" MaximumHeightRequest="5" MaximumWidthRequest="5" Clicked="OnAddClicked"/>
</Grid>
</DataTemplate>
@ -77,9 +78,9 @@
<DataTemplate>
<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}" FontSize="Medium" VerticalOptions="Center" Margin="15"/>
<Label Grid.Column="2" Text="4/5" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="Center"/>
<Label Grid.Column="3" Text="{Binding NbEpisodes}" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="End"/>
<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="3" Text="{Binding NbEpisodes}" TextColor="White" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="End"/>
</Grid>
</DataTemplate>
</BindableLayout.ItemTemplate>
@ -116,9 +117,9 @@
<DataTemplate>
<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}" FontSize="Medium" VerticalOptions="Center" Margin="15"/>
<Label Grid.Column="2" Text="4/5" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="Center"/>
<Label Grid.Column="3" Text="{Binding NbEpisodes}" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="End"/>
<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="3" Text="{Binding NbEpisodes}" TextColor="White" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="End"/>
</Grid>
</DataTemplate>
</BindableLayout.ItemTemplate>
@ -155,9 +156,9 @@
<DataTemplate>
<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}" FontSize="Medium" VerticalOptions="Center" Margin="15"/>
<Label Grid.Column="2" Text="4/5" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="Center"/>
<Label Grid.Column="3" Text="{Binding NbEpisodes}" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="End"/>
<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 NbEpisodesVus}" TextColor="White" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="End"/>
</Grid>
</DataTemplate>
</BindableLayout.ItemTemplate>

@ -21,4 +21,16 @@ public partial class listPage : ContentPage
await Navigation.PushAsync(new ficheAnime(selectedAnime));
}
}
private async void OnAddClicked(object sender, EventArgs e)
{
var button = (ImageButton)sender;
var oeuvre = (Oeuvre)button.BindingContext;
// Mettez à jour le nombre d'épisodes vus
oeuvre.AjouterEpisode(1);
// Sauvegardez les modifications
my_manager.sauvegarder();
}
}

@ -14,7 +14,7 @@ public partial class settingsPage : ContentPage
{
my_manager.UtilisateurActuel = new Utilisateur();
my_manager.isAdmin = false;
await Shell.Current.Navigation.PushAsync(new loginPage());
await Shell.Current.GoToAsync("//page/secondaire/connexionPage");
}
private async void LoginAdminClicked(object sender, EventArgs e)

Loading…
Cancel
Save