Finish the Custom Files DataBinding development
continuous-integration/drone/push Build is failing Details

pull/25/head
Corentin LEMAIRE 2 years ago
parent 210dd80a32
commit 3beaf2a7af

@ -21,6 +21,10 @@ public partial class App : Application
{
var Window = base.CreateWindow(activationState);
Window.Stopped += (sender, eventArgs) => {
Manager.SaveSerialization();
};
const int newHeight = 900;
const int newWidth = 1800;
const int minHeight = 800;

@ -0,0 +1,22 @@
using System;
namespace Linaris.Converters
{
public class InverseBooleanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is bool boolValue)
{
return !boolValue;
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

@ -34,7 +34,7 @@
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<MauiIcon Include="Resources\AppIcon\lin.svg"/>
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />

@ -1,12 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Linaris"
xmlns:manager="clr-namespace:Model;assembly=Model"
xmlns:local="clr-namespace:Linaris"
xmlns:model="clr-namespace:Model;assembly=Model"
xmlns:converters="clr-namespace:Linaris.Converters"
x:Class="Linaris.LocalFilesPage"
Title="LocalFilesPage"
Style="{StaticResource PageFlyoutTrigger}">
<ContentPage.Resources>
<converters:InverseBooleanConverter x:Key="InverseBooleanConverter" />
</ContentPage.Resources>
<Grid Style="{StaticResource GridFlyoutTrigger}" RowDefinitions="*,100">
<local:Layout Grid.Column="0"/>
<ScrollView Grid.Column="1" Grid.Row="0" BackgroundColor="#404040">
@ -15,16 +20,50 @@
<FlexLayout Direction="Row" AlignItems="Start" BindableLayout.ItemsSource="{Binding CustomTitles}" JustifyContent="SpaceAround" Wrap="Wrap">
<BindableLayout.ItemTemplate>
<DataTemplate>
<VerticalStackLayout Margin="10">
<ImageButton Grid.Row="0" Source="{Binding ImageURL}" Style="{StaticResource Pochette}"/>
<Label Grid.Row="1" Text="{Binding Name}" Style="{StaticResource Titre}"/>
</VerticalStackLayout>
<Grid ColumnDefinitions="2*,*">
<VerticalStackLayout Margin="10" Grid.ColumnSpan="2">
<Image Source="{Binding ImageURL}" Aspect="Fill" HorizontalOptions="Center" VerticalOptions="Center" HeightRequest="150" WidthRequest="150" IsAnimationPlaying="True" InputTransparent="False">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="ShowSubMenu" Command="{Binding ShowSubMenu}"/>
</Image.GestureRecognizers>
</Image>
<Label Text="{Binding Name}" Style="{StaticResource Titre}" IsVisible="{Binding IsRenaming, Converter={StaticResource InverseBooleanConverter}}" HorizontalTextAlignment="Center" WidthRequest="250" LineBreakMode="TailTruncation"/>
<Entry Text="{Binding NewName}" Placeholder="Nouveau nom" IsVisible="{Binding IsRenaming}" Completed="RenameCustomTitle"/>
</VerticalStackLayout>
<Grid IsVisible="{Binding IsSubMenuVisible}" BackgroundColor="Grey" HeightRequest="125" WidthRequest="155" Grid.Column="0" RowDefinitions="*,*,*,*">
<Button Grid.Row="0" Text="Ajouter à une playlist" Clicked="ShowPlaylistMenu"/>
<Button Grid.Row="1" Text="Supprimer" Clicked="RemoveCustomTitle"/>
<Button Grid.Row="2" Text="Renommer" Clicked="RenameCustomTitle"/>
<Button Grid.Row="3" Text="Changer l'image" Clicked="ChangeImage"/>
</Grid>
<ScrollView Grid.Column="1" IsVisible="{Binding IsPlaylistMenuVisible}" BackgroundColor="Grey" WidthRequest="150" HeightRequest="200">
<StackLayout>
<Button Text="+ Nouvelle playlist" TextColor="CornflowerBlue" FontAttributes="Bold" Clicked="ShowNewPlaylistMenu" IsVisible="{Binding IsNewPlaylistMenuVisible, Converter={StaticResource InverseBooleanConverter}}"/>
<Entry Placeholder="Nom de la playlist" PlaceholderColor="LightGrey" IsVisible="{Binding IsNewPlaylistMenuVisible}" Completed="AddPlaylist"/>
<StackLayout BindableLayout.ItemsSource="{Binding Source={RelativeSource AncestorType={x:Type ContentPage}}, Path=Playlists}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Button Text="{Binding Name}" Clicked="AddToPlaylist"/>
</DataTemplate>
</BindableLayout.ItemTemplate>
</StackLayout>
</StackLayout>
</ScrollView>
<Grid.GestureRecognizers>
<TapGestureRecognizer />
</Grid.GestureRecognizers>
</Grid>
</DataTemplate>
</BindableLayout.ItemTemplate>
</FlexLayout>
<Button WidthRequest="300" HeightRequest="50" Margin="0,20,0,20" BackgroundColor="{StaticResource Primary}" Text="Ajouter d'autres titres" Clicked="AddCustomTitle"/>
<Button WidthRequest="300" HeightRequest="50" Margin="0,20,0,20" BackgroundColor="{StaticResource Primary}" Text="Ajouter d'autres titres" Clicked="AddTitles"/>
</VerticalStackLayout>
</ScrollView>
<local:FooterPage Grid.Row="1" Grid.ColumnSpan="2"/>
<Grid.GestureRecognizers>
<TapGestureRecognizer Tapped="ResetAll"/>
</Grid.GestureRecognizers>
</Grid>
</ContentPage>

@ -1,29 +1,286 @@
using Model;
using Model.Serialization;
using Model.Stub;
using System;
using System.Collections.ObjectModel;
using System.Diagnostics.Eventing.Reader;
namespace Linaris;
public partial class LocalFilesPage : ContentPage
namespace Linaris
{
public partial class LocalFilesPage : ContentPage
{
private ObservableCollection<CustomTitle> customTitles = App.Manager.GetCustomTitles();
private ObservableCollection<CustomTitle> customTitles = App.Manager.GetCustomTitles();
public ObservableCollection<CustomTitle> CustomTitles
{
get => customTitles;
}
public ObservableCollection<CustomTitle> CustomTitles
{
get => customTitles;
}
private ObservableCollection<Playlist> playlists = App.Manager.GetPlaylists();
public LocalFilesPage()
{
InitializeComponent();
BindingContext = this;
}
public ObservableCollection<Playlist> Playlists
{
get => playlists;
}
void AddCustomTitle(object sender, EventArgs e)
{
App.Manager.AddCustomTitle(new CustomTitle());
customTitles = App.Manager.GetCustomTitles();
public LocalFilesPage()
{
InitializeComponent();
BindingContext = this;
}
// Reset methods
void ResetAll(object sender, EventArgs e)
{
ResetSubMenus(sender, e);
ResetRenaming(sender, e);
}
void ResetSubMenus(object sender, EventArgs e)
{
foreach (var CustomTitle in customTitles)
{
CustomTitle.IsSubMenuVisible = false;
}
ResetPlaylistMenu(sender, e);
}
void ResetRenaming(object sender, EventArgs e)
{
foreach (var CustomTitle in customTitles)
{
CustomTitle.IsRenaming = false;
CustomTitle.Name = CustomTitle.NewName;
}
}
void ResetPlaylistMenu(object sender, EventArgs e)
{
foreach (CustomTitle customTitle in CustomTitles)
{
customTitle.IsPlaylistMenuVisible = false;
customTitle.IsNewPlaylistMenuVisible = false;
}
}
// Add methods
void AddCustomTitle(CustomTitle customTitle)
{
App.Manager.AddCustomTitle(customTitle);
customTitles.Add(customTitle);
ResetAll(this, null);
}
private async void AddTitles(object sender, EventArgs e)
{
var results = await FilePicker.PickMultipleAsync(new PickOptions
{
PickerTitle = "Choisissez des nouveaux titres !",
FileTypes = new FilePickerFileType(
new Dictionary<DevicePlatform, IEnumerable<string>>
{
{ DevicePlatform.WinUI, new [] { "*.mp3", "*.m4a" } },
{ DevicePlatform.Android, new [] { "*.mp3", ".3gp", ".mp4", ".m4a", ".aac", ".ts", ".amr", ".flac", ".mid", ".xmf", ".mxmf", ".rtttl", ".rtx", ".ota", ".imy", ".mkv", ".ogg", ".wav" } },
{ DevicePlatform.iOS, new[] { "*.mp3", "*.aac", "*.aifc", "*.au", "*.aiff", "*.mp2", "*.3gp", "*.ac3" } }
})
});
if (results == null)
{
return;
}
if (sender is Button button)
{
foreach (var result in results)
{
CustomTitle custom = new CustomTitle(result.FileName, "none.png", "", result.FullPath);
if (!IsCustomTitleInCollection(custom))
{
AddCustomTitle(custom);
}
}
}
}
void AddToPlaylist(object sender, EventArgs e)
{
if (sender is Button button)
{
if (button.BindingContext is Playlist playlist)
{
if (button.Parent is StackLayout stack && stack.BindingContext is CustomTitle customTitle)
{
playlist.AddTitle(customTitle);
ResetAll(sender, e);
}
}
}
}
void AddPlaylist(object sender, EventArgs e)
{
if (sender is Entry entry)
{
Playlist playlist = new Playlist(entry.Text, "", "none.png");
if (!IsInPlaylists(playlist))
{
App.Manager.AddPlaylist(playlist);
playlists.Add(playlist);
}
if(entry.BindingContext is CustomTitle customTitle)
{
customTitle.IsNewPlaylistMenuVisible = false;
entry.Text = "";
}
}
}
// Remove methods
void RemoveCustomTitle(object sender, EventArgs e)
{
if (sender is Button button)
{
if (button.BindingContext is CustomTitle titleToRemove)
{
App.Manager.RemoveCustomTitle(titleToRemove);
customTitles.Remove(titleToRemove);
}
}
}
// Show methods
void ShowSubMenu(object sender, EventArgs e)
{
if (sender is Image button)
{
if (button.BindingContext is CustomTitle customTitle)
{
if (!customTitle.IsSubMenuVisible)
{
ResetAll(sender, e);
customTitle.IsSubMenuVisible = true;
}
else
{
ResetSubMenus(sender, e);
}
}
}
}
void ShowPlaylistMenu(object sender, EventArgs e)
{
if (sender is Button button)
{
if (button.BindingContext is CustomTitle customTitle)
{
if (!customTitle.IsPlaylistMenuVisible)
{
customTitle.IsPlaylistMenuVisible = true;
}
}
}
}
void ShowNewPlaylistMenu(object sender, EventArgs e)
{
if (sender is Button button)
{
if (button.BindingContext is CustomTitle customTitle)
{
if (!customTitle.IsNewPlaylistMenuVisible)
{
customTitle.IsNewPlaylistMenuVisible = true;
}
}
}
}
// Change methods
void RenameCustomTitle(object sender, EventArgs e)
{
ResetSubMenus(sender, e);
if (sender is Button button)
{
if (button.BindingContext is CustomTitle customTitle)
{
if (!customTitle.IsRenaming)
{
ResetRenaming(sender, e);
customTitle.IsRenaming = true;
}
else
{
ResetRenaming(sender, e);
}
}
}
else if (sender is Entry entry)
{
if (entry.BindingContext is CustomTitle customTitle)
{
ResetRenaming(sender, e);
customTitle.Name = customTitle.NewName;
}
}
}
private async void ChangeImage(object sender, EventArgs e)
{
var result = await FilePicker.PickAsync(new PickOptions
{
PickerTitle = "Choisissez une nouvelle image !",
FileTypes = FilePickerFileType.Images
});
if (result == null)
{
return;
}
if (sender is Button button)
{
if (button.BindingContext is CustomTitle customTitle)
{
customTitle.ImageURL = result.FullPath;
}
}
}
// Search methods
bool IsCustomTitleInCollection(CustomTitle customTitle)
{
foreach(var custom in customTitles)
{
if (customTitle.Equals(custom))
{
return true;
}
}
return false;
}
bool IsInPlaylists(Playlist playlist)
{
foreach (Playlist p in playlists)
{
if (p.Equals(playlist))
{
return true;
}
}
return false;
}
}
}
}

@ -3,4 +3,5 @@
<application android:allowBackup="false" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true" android:usesCleartextTraffic="false"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

@ -1,9 +1,11 @@
using Model.Stub;
using System.Runtime.CompilerServices;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace Model;
public class CustomTitle : Title {
public class CustomTitle : Title, INotifyPropertyChanged
{
public string Path
{
@ -15,11 +17,72 @@ public class CustomTitle : Title {
{
path = value;
}
OnPropertyChanged();
}
}
private string path = Manager.DEFAULT_URL;
public bool IsSubMenuVisible
{
get => isSubMenuVisible;
set
{
if (isSubMenuVisible != value)
{
isSubMenuVisible = value;
}
OnPropertyChanged();
}
}
private bool isSubMenuVisible = false;
public bool IsPlaylistMenuVisible
{
get => isPlaylistMenuVisible;
set
{
if (isPlaylistMenuVisible != value)
{
isPlaylistMenuVisible = value;
}
OnPropertyChanged();
}
}
private bool isPlaylistMenuVisible = false;
public bool IsRenaming
{
get => isRenaming;
set
{
if (isRenaming != value)
{
isRenaming = value;
}
OnPropertyChanged();
}
}
private bool isRenaming = false;
public bool IsNewPlaylistMenuVisible
{
get => isNewPlaylistMenuVisible;
set
{
if (isNewPlaylistMenuVisible != value)
{
isNewPlaylistMenuVisible = value;
}
OnPropertyChanged();
}
}
private bool isNewPlaylistMenuVisible = false;
public CustomTitle(string name, string imageURL, string information, string path) : base(name, imageURL, information)
{
Path = path;
@ -27,12 +90,15 @@ public class CustomTitle : Title {
public CustomTitle() : base(Manager.DEFAULT_NAME, Manager.DEFAULT_URL, Manager.DEFAULT_DESC) { }
public bool Equals(CustomTitle? other)
=> Path.Equals(other?.Path);
public override bool Equals(object? obj)
{
if (obj is null) return false;
if (obj.GetType() != typeof(CustomTitle)) return false;
if (obj is CustomTitle customTitle && ImageURL == customTitle.ImageURL) return true;
else return false;
if (ReferenceEquals(obj, null)) return false;
if (ReferenceEquals(this, obj)) return true;
if (GetType() != obj.GetType()) return false;
return Equals(obj as CustomTitle);
}
public override int GetHashCode()

@ -166,4 +166,9 @@ public class Manager
DataManager.SaveSerialization();
}
public Playlist? GetPlaylistByUrl(string url)
{
return DataManager.GetPlaylistByUrl(url);
}
}

@ -1,4 +1,5 @@
using Model.Stub;
using System.Collections.ObjectModel;
using System.Security.Cryptography;
using System.Xml.Serialization;
@ -36,7 +37,7 @@ public class Playlist
private string description = Manager.DEFAULT_DESC;
public IEnumerable<Title> Titles
public ObservableCollection<CustomTitle> Titles
{
get
{
@ -44,7 +45,7 @@ public class Playlist
}
}
private readonly List<Title> titles = new List<Title>();
private readonly ObservableCollection<CustomTitle> titles = new ObservableCollection<CustomTitle>();
public string ImageURL
{
@ -189,7 +190,7 @@ public class Playlist
{
if (obj is null) return false;
if (obj.GetType() != typeof(Playlist)) return false;
if (obj is Playlist playlist && ImageURL == playlist.ImageURL) return true;
if (obj is Playlist playlist && Name == playlist.Name) return true;
else return false;
}

@ -36,7 +36,7 @@ public class LinqXmlSerialization : IDataManager
}
}
private List<Album> albums;
private ObservableCollection<Album> albums;
public ObservableCollection<Album> Albums
{
@ -46,7 +46,7 @@ public class LinqXmlSerialization : IDataManager
}
}
private List<Playlist> playlists;
private ObservableCollection<Playlist> playlists;
public ObservableCollection<Playlist> Playlists
{
@ -56,7 +56,7 @@ public class LinqXmlSerialization : IDataManager
}
}
private List<InfoTitle> infoTitles;
private ObservableCollection<InfoTitle> infoTitles;
public ObservableCollection<InfoTitle> InfoTitles
{
@ -66,7 +66,7 @@ public class LinqXmlSerialization : IDataManager
}
}
private List<CustomTitle> customTitles;
private ObservableCollection<CustomTitle> customTitles;
public ObservableCollection<CustomTitle> CustomTitles
{
@ -78,11 +78,11 @@ public class LinqXmlSerialization : IDataManager
public LinqXmlSerialization()
{
playlists = new List<Playlist>();
playlists = new ObservableCollection<Playlist>();
artists = new List<Artist>();
albums = new List<Album>();
infoTitles = new List<InfoTitle>();
customTitles = new List<CustomTitle>();
albums = new ObservableCollection<Album>();
infoTitles = new ObservableCollection<InfoTitle>();
customTitles = new ObservableCollection<CustomTitle>();
if (!Directory.Exists(XMLPATH))
{
Directory.CreateDirectory(XMLPATH);
@ -213,12 +213,14 @@ public class LinqXmlSerialization : IDataManager
}
XDocument PlaylistsFichier = XDocument.Load(XMLFILEPLAYLISTS);
playlists = PlaylistsFichier.Descendants("Playlist")
var playlists2 = PlaylistsFichier.Descendants("Playlist")
.Select(eltPlaylist => new Playlist(
eltPlaylist.Attribute("Name")!.Value,
eltPlaylist.Element("Description")!.Value,
eltPlaylist.Element("ImageURL")!.Value
)).ToList();
playlists = new ObservableCollection<Playlist>(playlists2);
foreach (Playlist playlist in playlists)
{
var custom = PlaylistsFichier.Descendants("Playlist")
@ -329,10 +331,8 @@ public class LinqXmlSerialization : IDataManager
XDocument CustomsFile2 = new XDocument();
CustomTitle ct1 = new CustomTitle("ct1", "url1.png", "info1", "path1");
CustomTitle ct2 = new CustomTitle("ct2", "url2.png", "info2", "path2");
customTitles.Add(ct1);
customTitles.Add(ct2);
var custom = customTitles.Select(c => new XElement("CustomTitle",
new XAttribute("Name", c.Name),
@ -354,13 +354,14 @@ public class LinqXmlSerialization : IDataManager
}
XDocument CustomsFile = XDocument.Load(XMLFILECUSTOMS);
customTitles = CustomsFile.Descendants("CustomTitle")
var customTitles2 = CustomsFile.Descendants("CustomTitle")
.Select(eltPlaylist => new CustomTitle(
eltPlaylist.Attribute("Name")!.Value,
eltPlaylist.Element("ImageURL")!.Value,
eltPlaylist.Element("Information")!.Value,
eltPlaylist.Element("Path")!.Value
)).ToList();
customTitles = new ObservableCollection<CustomTitle>(customTitles2);
}
public void SaveCustomTitles()
@ -419,7 +420,7 @@ public class LinqXmlSerialization : IDataManager
}
XDocument AlbumsFile = XDocument.Load(XMLFILEALBUMS);
albums = AlbumsFile.Descendants("Album")
var albums2 = AlbumsFile.Descendants("Album")
.Select(eltPlaylist => new Album(
eltPlaylist.Attribute("Name")!.Value,
eltPlaylist.Element("ImageURL")!.Value,
@ -427,7 +428,7 @@ public class LinqXmlSerialization : IDataManager
eltPlaylist.Element("Description")!.Value,
eltPlaylist.Element("Information")!.Value
)).ToList();
albums = new ObservableCollection<Album>(albums2);
foreach (Album a in albums)
@ -508,7 +509,7 @@ public class LinqXmlSerialization : IDataManager
}
XDocument InfosFile = XDocument.Load(XMLFILEINFOS);
infoTitles = InfosFile.Descendants("InfoTitle")
var infoTitles2 = InfosFile.Descendants("InfoTitle")
.Select(eltPlaylist => new InfoTitle(
eltPlaylist.Attribute("Name")!.Value,
eltPlaylist.Element("ImageURL")!.Value,
@ -517,6 +518,8 @@ public class LinqXmlSerialization : IDataManager
eltPlaylist.Element("Description")!.Value,
GetGenreByName(eltPlaylist.Element("Genre")!.Value)
)).ToList();
infoTitles = new ObservableCollection<InfoTitle>(infoTitles2);
foreach (InfoTitle it in infoTitles)
{
var feat = InfosFile.Descendants("InfoTitle")

@ -16,9 +16,16 @@ public class StubPlaylist
{
Playlist Playlist1 = new Playlist("Playlist1", "desc1", "url1.png");
Playlist Playlist2 = new Playlist("Playlist2", "desc2", "url2.png");
Playlist Playlist3 = new Playlist("Playlist3", "desc3", "url3.png");
Playlist Playlist4 = new Playlist("Playlist4", "desc4", "url4.png");
Playlist Playlist5 = new Playlist("Playlist5", "desc5", "url5.png");
Playlist Playlist6 = new Playlist("Playlist6", "desc6", "url6.png");
Playlist Playlist7 = new Playlist("Playlist7", "desc7", "url7.png");
Playlist Playlist8 = new Playlist("Playlist8", "desc8", "url8.png");
Playlist Playlist9 = new Playlist("Playlist9", "desc9", "url9.png");
playlists = new ObservableCollection<Playlist>()
{
Playlist1, Playlist2
Playlist1, Playlist2, Playlist3, Playlist4, Playlist5, Playlist6, Playlist7, Playlist8, Playlist9
};
}

@ -1,87 +1,106 @@
using Model.Stub;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Xml.Serialization;
namespace Model
namespace Model;
public class Title
{
public class Title
public event PropertyChangedEventHandler? PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string? propertyName = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public string Name
{
public string Name
{
get => name;
get => name;
set
set
{
if (value.Length > Manager.MAX_NAME_LENGTH || string.IsNullOrWhiteSpace(value))
{
if (value != null && value.Length < Manager.MAX_NAME_LENGTH)
{
name = value;
}
value = "IncorrectName";
}
name = value;
OnPropertyChanged();
}
}
private string name = Manager.DEFAULT_NAME;
private string name = Manager.DEFAULT_NAME;
public string ImageURL
public string NewName
{
get => newName;
set
{
get => imageURL;
newName = value;
}
}
private string newName = Manager.DEFAULT_NAME;
set
public string ImageURL
{
get => imageURL;
set
{
if (value == null || !value.Contains('.'))
{
if (value == null || !value.Contains('.'))
{
value = "none.png";
imageURL = value;
}
if (value.Contains(' '))
{
imageURL = value.Replace(' ', '_');
}
else if (value.Contains('.'))
{
imageURL = value;
}
value = "none.png";
imageURL = value;
}
else if (value.Contains('.'))
{
imageURL = value;
}
OnPropertyChanged();
}
}
private string imageURL = Manager.DEFAULT_URL;
private string imageURL = Manager.DEFAULT_URL;
public string Information
{
get => information;
public string Information
{
get => information;
set
set
{
if (value != null && value.Length < Manager.MAX_DESCRIPTION_LENGTH)
{
if (value != null && value.Length < Manager.MAX_DESCRIPTION_LENGTH)
{
information = value;
}
information = value;
}
OnPropertyChanged();
}
}
private string information = Manager.DEFAULT_DESC;
private string information = Manager.DEFAULT_DESC;
public Title(string nom, string file_Name, string informations)
{
Name = nom;
ImageURL = file_Name;
Information = informations;
}
public Title(string nom, string file_Name, string informations)
{
Name = nom;
NewName = nom;
ImageURL = file_Name;
Information = informations;
}
public override bool Equals(object? obj)
{
if (obj is null) return false;
if (obj.GetType() != typeof(Title)) return false;
if (obj is Title title && ImageURL == title.ImageURL) return true;
else return false;
}
public override bool Equals(object? obj)
{
if (obj is null) return false;
if (obj.GetType() != typeof(Title)) return false;
if (obj is Title title && Name == title.Name) return true;
else return false;
}
public override int GetHashCode()
{
return ImageURL.GetHashCode();
}
public override int GetHashCode()
{
return ImageURL.GetHashCode();
}
public override string ToString()
{
return $"Name : {Name}";
}
public override string ToString()
{
return $"Name : {Name}";
}
}

Loading…
Cancel
Save