You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
2.5 KiB
104 lines
2.5 KiB
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 : INotifyPropertyChanged
|
|
{
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
[DataMember(Name = "nom")]
|
|
private string? nom;
|
|
public string? Nom {
|
|
get => nom;
|
|
set
|
|
{
|
|
if (nom == value)
|
|
{
|
|
return;
|
|
}
|
|
|
|
nom = value;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
|
|
[DataMember(Name = "image")]
|
|
private string? image;
|
|
public string? Image {
|
|
get => image;
|
|
set
|
|
{
|
|
|
|
if (image == value)
|
|
return;
|
|
image = value;
|
|
OnPropertyChanged();
|
|
|
|
}
|
|
}
|
|
|
|
[DataMember(Name = "estfavori")]
|
|
private bool estfavori;
|
|
public bool EstFavori {
|
|
get=>estfavori;
|
|
set
|
|
{
|
|
if (estfavori == value)
|
|
return;
|
|
estfavori = value;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public ObjetOhara(string nom, string image = "baseimage.png", bool estFavori = false)
|
|
{
|
|
|
|
Nom = nom;
|
|
Image = image;
|
|
EstFavori = estFavori;
|
|
}
|
|
|
|
|
|
|
|
public override bool Equals(object? obj)
|
|
{
|
|
if (obj == null) return false;
|
|
if (this.GetType() != obj.GetType())
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
ObjetOhara o = (ObjetOhara)obj;
|
|
return o.Nom == Nom;
|
|
}
|
|
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
|
|
return HashCode.Combine(Nom, Image,EstFavori);
|
|
}
|
|
public override string ToString()
|
|
{
|
|
return "ObjetOhara :" + Nom + " " +EstFavori+ " " + Image;
|
|
}
|
|
|
|
protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
|
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
}
|
|
|
|
|