Créer FDD
continuous-integration/drone/push Build is passing Details

pull/15/head
Yoan BRUGIÈRE 2 years ago
parent f96143711e
commit f76cc48ea6

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
@ -9,7 +10,7 @@ using System.Xml.Linq;
namespace Model.Classes
{
[DataContract(Name = "fruitdudemon")]
public class FruitDuDemon : ObjetOhara
public class FruitDuDemon : ObjetOhara,INotifyPropertyChanged
{
[DataMember(Name = "nomromanise")]
public string NomRomanise { get; set; }
@ -28,7 +29,7 @@ namespace Model.Classes
[DataMember(Name = "utilisateur", EmitDefaultValue = false)]
public List<Personnage> Utilisateur { get; set; } = new List<Personnage>();
public event PropertyChangedEventHandler? PropertyChanged;
public FruitDuDemon(string nom, string nomRomanise, string type, int premierChap, int premierEp, string description, string forces, string faiblesses) : base(nom)
{
@ -67,6 +68,8 @@ namespace Model.Classes
Utilisateur = utilisateur;
}
public override bool Equals(object? obj)
{
if (obj == null) return false;
@ -91,5 +94,13 @@ namespace Model.Classes
{
return "FruitDuDemon :" + Nom +" " +EstFavori+" " + NomRomanise + " " + Type + " " + PremierChap + " " + PremierEp + " " + Description + " " + Forces +" "+Faiblesses+ " " + Image;
}
void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}

@ -1,24 +1,55 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace Model.Classes
{
[DataContract(Name = "objetohara")]
public class ObjetOhara
public class ObjetOhara : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
[DataMember(Name = "nom")]
public string Nom { get; set; }
private string nom;
public string Nom {
get => nom;
set
{
if (nom == value)
{
return;
}
nom = value;
OnPropertyChanged();
}
}
[DataMember(Name = "image")]
public string? Image { get; set; }
private string? image;
public string? Image {
get => image;
set
{
if (image == value)
return;
image = value;
OnPropertyChanged();
}
}
[DataMember(Name = "estfavori")]
public bool EstFavori { get; set; }
public ObjetOhara(string nom, string image = "baseimage.png", bool estFavori = false)
{
Nom = nom;
@ -26,6 +57,8 @@ namespace Model.Classes
EstFavori = estFavori;
}
public override bool Equals(object? obj)
{
if (obj == null) return false;
@ -50,6 +83,9 @@ namespace Model.Classes
{
return "ObjetOhara :" + Nom + " " +EstFavori+ " " + Image;
}
void OnPropertyChanged([CallerMemberName] string propertyName = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}

@ -227,7 +227,15 @@ namespace Model.Managers
}
public void AjouterFDD(FruitDuDemon fruit)
{
if (fruit == null)
{
return;
}
Fruits.Add(fruit);
}
}
}

@ -3,9 +3,104 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Ohara.ModalFDD"
Title="ModalFDD"
BackgroundColor="#e2edf1">
<StackLayout>
<Button Text="Annuler" Clicked="Button_Clicked"/>
</StackLayout>
<HorizontalStackLayout HorizontalOptions="Center" VerticalOptions="Center">
<VerticalStackLayout Spacing="2" Padding="5">
<Frame Style="{StaticResource frameInfo}">
<HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Nom :" TextColor="#72a3b3" FontAttributes="Bold"/>
<Entry Text="{Binding Nom}"/>
</HorizontalStackLayout>
</Frame>
<Frame Style="{StaticResource frameInfo}">
<HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Nom Romanise :" TextColor="#72a3b3" FontAttributes="Bold"/>
<Entry Text="{Binding NomRomanise}"/>
</HorizontalStackLayout>
</Frame>
<Frame Style="{StaticResource frameInfo}">
<HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Type :" TextColor="#72a3b3" FontAttributes="Bold"/>
<Entry Text="{Binding Type}"/>
</HorizontalStackLayout>
</Frame>
<Frame Style="{StaticResource frameInfo}">
<HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Premier Chapitre :" TextColor="#72a3b3" FontAttributes="Bold"/>
<Entry Text="{Binding PremierChap}" />
</HorizontalStackLayout>
</Frame>
<Frame Style="{StaticResource frameInfo}">
<HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Premier Episode :" TextColor="#72a3b3" FontAttributes="Bold"/>
<Entry Text="{Binding PremierEp}" />
</HorizontalStackLayout >
</Frame>
<Frame Style="{StaticResource frameInfo}">
<HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Description :" TextColor="#72a3b3" FontAttributes="Bold"/>
<Entry Text="{Binding Description}"/>
</HorizontalStackLayout>
</Frame>
<Frame Style="{StaticResource frameInfo}">
<HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Forces :" TextColor="#72a3b3" FontAttributes="Bold"/>
<Entry Text="{Binding Forces}"/>
</HorizontalStackLayout>
</Frame>
<Frame Style="{StaticResource frameInfo}">
<HorizontalStackLayout HorizontalOptions="Center">
<Label Text="Faiblesses :" TextColor="#72a3b3" FontAttributes="Bold" />
<Entry Text="{Binding Faiblesses}" />
</HorizontalStackLayout>
</Frame>
<Frame Style="{StaticResource frameInfo}">
<HorizontalStackLayout HorizontalOptions="Center">
<Button Text="Annuler" Clicked="ButtonAnnuler_Clicked" />
<Button Text="Confirmer" Clicked="ButtonConfirmer_Clicked" />
</HorizontalStackLayout>
</Frame>
</VerticalStackLayout>
<!--<VerticalStackLayout Spacing="2" Padding="5">
<Frame Style="{StaticResource frameInfo}" >
<Label Text="Aperçu de l'objet :" HorizontalOptions="Center" Style="{StaticResource titreInfo}"/>
</Frame>
<Frame Style="{StaticResource frameInfo}">
<Label Text="{Binding Nom}" HorizontalOptions="Center" Style="{StaticResource titreInfo}" />
</Frame>
<Frame Style="{StaticResource frameInfo}">
<Image
Source="{Binding Image}"
HeightRequest="250"
WidthRequest="250"/>
</Frame>
<Frame Style="{StaticResource frameInfo}">
<HorizontalStackLayout Spacing="5" HorizontalOptions="Center">
<Label Text="Nom romanisé :" TextColor="#72a3b3" FontAttributes="Bold"/>
<Label Text="{Binding NomRomanise}" TextColor="#72a3b3"/>
</HorizontalStackLayout>
</Frame>
<Frame Style="{StaticResource frameInfo}">
<HorizontalStackLayout Spacing="5" HorizontalOptions="Center">
<Label Text="Type :" TextColor="#72a3b3" FontAttributes="Bold"/>
<Label Text="{Binding Type}" TextColor="#72a3b3"/>
</HorizontalStackLayout>
</Frame>
<Frame Style="{StaticResource frameInfo}">
<HorizontalStackLayout Spacing="5" HorizontalOptions="Center">
<Label Text="Premier apparition (chapitre) :" TextColor="#72a3b3" FontAttributes="Bold"/>
<Label Text="{Binding PremierChap}" TextColor="#72a3b3"/>
</HorizontalStackLayout>
</Frame>
<Frame Style="{StaticResource frameInfo}">
<HorizontalStackLayout Spacing="5" HorizontalOptions="Center">
<Label Text="Premier apparition (episode) :" TextColor="#72a3b3" FontAttributes="Bold"/>
<Label Text="{Binding PremierEp}" TextColor="#72a3b3"/>
</HorizontalStackLayout>
</Frame>
</VerticalStackLayout>-->
</HorizontalStackLayout>
</ContentPage>

@ -1,13 +1,25 @@
using Model.Classes;
using Model.Managers;
namespace Ohara;
public partial class ModalFDD : ContentPage
{
{
public Manager manager => (App.Current as App).manager;
public FruitDuDemon nouveauFDD = new FruitDuDemon("Fruit","","",0,0,"","","");
public ModalFDD()
{
InitializeComponent();
}
BindingContext = nouveauFDD;
private async void Button_Clicked(object sender, EventArgs e)
}
private async void ButtonConfirmer_Clicked(object sender, EventArgs e)
{
manager.AjouterFDD(nouveauFDD);
await Navigation.PopModalAsync();
}
private async void ButtonAnnuler_Clicked(object sender, EventArgs e)
{
await Navigation.PopModalAsync();
}

Loading…
Cancel
Save