From b7d23ecaff1ebe56c6efbb956dc81c9dd53e0304 Mon Sep 17 00:00:00 2001 From: V J Date: Sat, 10 Jun 2023 20:01:12 +0200 Subject: [PATCH] =?UTF-8?q?mise=20=C3=A0=20jour=20du=20d=C3=A9placement=20?= =?UTF-8?q?des=20utilisateurs=20dans=20l'interface=20+=20liste=20avec=20av?= =?UTF-8?q?ancement=20de=20l'utilisateur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MangaMap/CustomHeader.xaml | 2 +- src/MangaMap/CustomHeader.xaml.cs | 16 +++++++++++++- src/MangaMap/MangaMap.csproj | 11 ++++++++++ src/MangaMap/Resources/Images/connected.png | Bin 0 -> 1324 bytes src/MangaMap/Views/Composants/ListOeuvre.xaml | 20 +++++++++++------- .../Views/Composants/ListOeuvre.xaml.cs | 1 + src/MangaMap/Views/FicheAnime.xaml.cs | 2 +- src/MangaMap/Views/homePage.xaml.cs | 6 ++---- src/MangaMap/Views/loginPage.xaml.cs | 10 +++++++++ src/MangaMap/Views/settingsPage.xaml.cs | 6 ++++++ src/Models/Oeuvre.cs | 3 +++ 11 files changed, 62 insertions(+), 15 deletions(-) create mode 100644 src/MangaMap/Resources/Images/connected.png diff --git a/src/MangaMap/CustomHeader.xaml b/src/MangaMap/CustomHeader.xaml index 6e9f252..a801373 100644 --- a/src/MangaMap/CustomHeader.xaml +++ b/src/MangaMap/CustomHeader.xaml @@ -21,7 +21,7 @@ IsVisible="{Binding IsUserLoggedIn}" /> @@ -35,7 +40,7 @@ public partial class NewContent1 : ContentView, INotifyPropertyChanged /// L'objet déclencheur de l'événement. /// Les arguments de l'événement. async void SettingButton_Clicked(object sender, System.EventArgs e) - { + { await Shell.Current.GoToAsync("//page/secondaire/settingsPage"); } @@ -46,6 +51,10 @@ public partial class NewContent1 : ContentView, INotifyPropertyChanged /// Les arguments de l'événement. async void AccountButton_Clicked(object sender, System.EventArgs e) { + if (my_manager.UtilisateurActuel.Email != null) + { + return; + } await Shell.Current.GoToAsync("//page/secondaire/connexionPage"); } @@ -56,6 +65,11 @@ public partial class NewContent1 : ContentView, INotifyPropertyChanged /// Les arguments de l'événement. async void ListButton_Clicked(object sender, System.EventArgs e) { + if (my_manager.UtilisateurActuel.Email == null) + { + return; + } await Navigation.PushAsync(new listPage()); + //await Shell.Current.GoToAsync("//page/secondaire/listPage"); } } \ No newline at end of file diff --git a/src/MangaMap/MangaMap.csproj b/src/MangaMap/MangaMap.csproj index 8b91f47..d3f4e1d 100644 --- a/src/MangaMap/MangaMap.csproj +++ b/src/MangaMap/MangaMap.csproj @@ -11,6 +11,16 @@ true enable + + MangaMap @@ -135,6 +145,7 @@ + diff --git a/src/MangaMap/Resources/Images/connected.png b/src/MangaMap/Resources/Images/connected.png new file mode 100644 index 0000000000000000000000000000000000000000..4cd5f02393f95a18c28dee9efafcb4b69dd91e15 GIT binary patch literal 1324 zcmV+{1=IS8P)Px(=1D|BRA@u(nQ5qYQxwO4?*|#m6nY7TWF9k<>4PCt=2vEA`e0V(LJ5(fC?Qd1 zG8B@b49S#Plp#aLk_<(@DE;2nzAdM7&a=#r&U`xRNG}|OIqqkSf2II70Zs|Sw;E{82La?x;M0M9 zr5z`20`XCi+BHvu;S{vRaM0dO>M39xAz>2F}Un9*0__ebC-U}<2(bZrFe z1uWaJ^b_D};DI3sh61<6W6O$s1zas7(;H#cNhJaAbv%tPdpObS^ABa%^G+Y3A=8N$@^Z(`X@{b6q zk2D6nFji~SWR~|?r_Tf+kXGpfV0e5zMVniIvyztmfM?SEKEU(95kM2f!+=1(twixs zI{j+A?+*0JEZ5R&itL zE=7#dx5- zq~R{$~h5@Gj$HriMt%|FFOQW$~Q1<5HM{O(M&UcBM@*Z$TM5o%p$I;Fr z$-JOE8Ll^_w+(<{E*B?KVv$SS=0Y|IS8{BNpsh!_kO{=7p=93EWxS=M(dF~V#5EwD z)y;sXD@sfENhx#;CMypCAP{48mmCM&0IU`bjO)$B)$E&d%rC(CfSJ5YR*Wd<`ziq0 zg|>(&)TO-1RBhLml}rDnVx?TQBBL1R=DFq#wD zs7<^|a1~d|l2dp1xzBn)qG+L0Ht|!yuRVP-E3QgpnM!;al-bg8F2s`#55m@u!KWhIi%DUTtv()u4K8Tx zmp6~}+KT9h30W^QwIbB#mCj%?q^N%Z*n2_%JRI=&QJHp8Z|CN*%B{eevkb!OPu5#x z+Q%wIK{N4q?r9vK4e>a}6OAIHXh!uXrsmP2RoYQAIoEHXH)wcBEbl2Ywxh+Ouz9#^ z_LOSOv^uj~lq#6ji;Vqnw4_n+{Azrm2Sx8hK5&%5=JhA0y#MCyN4~ZYIxj!7&PFa6q;u2Mv0!UaIk{6;hY0000 - + @@ -70,11 +71,12 @@ - + @@ -109,11 +111,12 @@ - + @@ -148,11 +151,12 @@ - + diff --git a/src/MangaMap/Views/Composants/ListOeuvre.xaml.cs b/src/MangaMap/Views/Composants/ListOeuvre.xaml.cs index 72a153e..7b1f8ae 100644 --- a/src/MangaMap/Views/Composants/ListOeuvre.xaml.cs +++ b/src/MangaMap/Views/Composants/ListOeuvre.xaml.cs @@ -1,5 +1,6 @@ namespace MangaMap.Views.Composants; using Models; +using System.Diagnostics; using System.Xml; public partial class ListOeuvre : ContentView diff --git a/src/MangaMap/Views/FicheAnime.xaml.cs b/src/MangaMap/Views/FicheAnime.xaml.cs index 8564ae1..033403f 100644 --- a/src/MangaMap/Views/FicheAnime.xaml.cs +++ b/src/MangaMap/Views/FicheAnime.xaml.cs @@ -279,7 +279,6 @@ namespace MangaMap.Views my_manager.UtilisateurActuel.notesNombres.Remove(AnimeModel.Nom, out x); x[1] = nb; my_manager.UtilisateurActuel.notesNombres.Add(AnimeModel.Nom, x); - return; } else { @@ -288,6 +287,7 @@ namespace MangaMap.Views my_manager.UtilisateurActuel.notesNombres.Add(AnimeModel.Nom, x); } + AnimeModel.NombresEpVu = nb; my_manager.sauvegarder(); } } diff --git a/src/MangaMap/Views/homePage.xaml.cs b/src/MangaMap/Views/homePage.xaml.cs index 86f369e..2b81c2e 100644 --- a/src/MangaMap/Views/homePage.xaml.cs +++ b/src/MangaMap/Views/homePage.xaml.cs @@ -52,13 +52,11 @@ namespace MangaMap.Views int imagesParLigne = 4; int indice = 0; - for (int i = 0; i < my_manager.Oeuvres.Count; i++) + foreach (Oeuvre o in my_manager.Oeuvres) { - Oeuvre favoris = my_manager.Oeuvres[i]; - ImageButton imageButton = new ImageButton { - Source = favoris.Affiche, + Source = o.Affiche, WidthRequest = 170, MaximumHeightRequest = 190, MinimumHeightRequest = 190, diff --git a/src/MangaMap/Views/loginPage.xaml.cs b/src/MangaMap/Views/loginPage.xaml.cs index 91ab0fa..e3d6b29 100644 --- a/src/MangaMap/Views/loginPage.xaml.cs +++ b/src/MangaMap/Views/loginPage.xaml.cs @@ -3,6 +3,7 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using Stub; using Models; +using System.Diagnostics; /// /// Classe représentant la page de connexion de l'application. @@ -68,6 +69,15 @@ public partial class loginPage : ContentPage // On garde l'utilisateur qui vient de se connecter pour accéder à ses informations my_manager.UtilisateurActuel = utilisateur; + List x; + foreach (Oeuvre o in my_manager.Oeuvres) + { + if (my_manager.UtilisateurActuel.notesNombres.TryGetValue(o.Nom, out x)) + o.NombresEpVu = x[1]; + else + o.NombresEpVu = 0; + } + // Rediriger l'utilisateur vers la page principale await Shell.Current.GoToAsync("//page/homePage"); } diff --git a/src/MangaMap/Views/settingsPage.xaml.cs b/src/MangaMap/Views/settingsPage.xaml.cs index bbbdc24..e85426d 100644 --- a/src/MangaMap/Views/settingsPage.xaml.cs +++ b/src/MangaMap/Views/settingsPage.xaml.cs @@ -28,6 +28,12 @@ public partial class settingsPage : ContentPage { my_manager.UtilisateurActuel = new Utilisateur(); my_manager.isAdmin = false; + + foreach (Oeuvre o in my_manager.Oeuvres) + { + o.NombresEpVu = 999; + } + await Shell.Current.GoToAsync("//page/secondaire/connexionPage"); } diff --git a/src/Models/Oeuvre.cs b/src/Models/Oeuvre.cs index f8295e9..6858482 100644 --- a/src/Models/Oeuvre.cs +++ b/src/Models/Oeuvre.cs @@ -74,6 +74,9 @@ namespace Models [DataMember] public string Affiche { get; private set; } + [DataMember] + public int NombresEpVu { get; set; } + /// /// Initialise une nouvelle instance de la classe Oeuvre avec les informations spécifiées. ///