From 0cd706dc145b11e18679a50732bfe4052c6841a9 Mon Sep 17 00:00:00 2001 From: Corentin LEMAIRE Date: Wed, 24 May 2023 23:17:18 +0200 Subject: [PATCH] Fix serialization with binding --- Sources/Linaris/AlbumPage.xaml | 2 +- Sources/Linaris/App.xaml.cs | 4 +- Sources/Linaris/FooterPage.xaml.cs | 6 + Sources/Linaris/InfoTitlePage.xaml | 4 +- Sources/Linaris/InfoTitlePage.xaml.cs | 15 +- Sources/Linaris/Linaris.csproj | 4 +- Sources/Linaris/LocalFilesPage.xaml.cs | 9 +- Sources/Linaris/MainPage.xaml | 6 +- Sources/Linaris/MainPage.xaml.cs | 7 +- Sources/Linaris/MauiProgram.cs | 5 +- Sources/Linaris/PlaylistPage.xaml | 13 +- Sources/Linaris/PlaylistPage.xaml.cs | 47 +++ Sources/Linaris/Resources/Styles/Styles.xaml | 67 ++- Sources/Model/Album.cs | 18 +- Sources/Model/Data/customs.xml | 28 +- Sources/Model/Data/playlists.xml | 6 +- Sources/Model/IDataManager.cs | 10 +- Sources/Model/InfoTitle.cs | 19 +- Sources/Model/Manager.cs | 20 +- Sources/Model/Playlist.cs | 11 +- .../Serialization/LINQ_XML_Serialization.cs | 391 ++---------------- Sources/Model/Stub/StubArtist.cs | 7 +- Sources/Model/Stub/StubInfoTitle.cs | 34 +- Sources/Model/Stub/StubManager.cs | 148 ++----- Sources/TestUnitaires/TU_Album.cs | 6 +- Sources/TestUnitaires/TU_InfoTitle.cs | 32 +- 26 files changed, 341 insertions(+), 578 deletions(-) diff --git a/Sources/Linaris/AlbumPage.xaml b/Sources/Linaris/AlbumPage.xaml index 79bcdc6..1aab1d9 100644 --- a/Sources/Linaris/AlbumPage.xaml +++ b/Sources/Linaris/AlbumPage.xaml @@ -35,7 +35,7 @@ Style="{StaticResource SousTitre}"> - + diff --git a/Sources/Linaris/App.xaml.cs b/Sources/Linaris/App.xaml.cs index 936af33..e0f54a0 100644 --- a/Sources/Linaris/App.xaml.cs +++ b/Sources/Linaris/App.xaml.cs @@ -18,9 +18,9 @@ public partial class App : Application var Window = base.CreateWindow(activationState); - Window.Created += (sender, eventArgs) => + Window.Stopped += (sender, eventArgs) => { - Manager.LoadSerialization(); + Manager.SaveSerialization(); }; const int newHeight = 900; diff --git a/Sources/Linaris/FooterPage.xaml.cs b/Sources/Linaris/FooterPage.xaml.cs index 568762f..97ebfa0 100644 --- a/Sources/Linaris/FooterPage.xaml.cs +++ b/Sources/Linaris/FooterPage.xaml.cs @@ -26,6 +26,7 @@ public partial class FooterPage : ContentView public void PlayButton_Clicked(object sender, EventArgs e) { + Play(); /*string url = ((FileImageSource)Play.Source).File; if (url == "play.png") { @@ -43,6 +44,11 @@ public partial class FooterPage : ContentView }*/ } + public void Play() + { + if ((Application.Current as App).Manager.CurrentPlaying == null) return; + } + public void RewindButton_Clicked(Object sender, EventArgs e) { /*audioFile.Position = 0; diff --git a/Sources/Linaris/InfoTitlePage.xaml b/Sources/Linaris/InfoTitlePage.xaml index e4a16f5..88a5662 100644 --- a/Sources/Linaris/InfoTitlePage.xaml +++ b/Sources/Linaris/InfoTitlePage.xaml @@ -13,13 +13,13 @@ - +