From fb5da57e19bd2fcc94d49a99d0180fcc28f845c9 Mon Sep 17 00:00:00 2001 From: tofages1 Date: Fri, 2 Jun 2023 08:55:47 +0100 Subject: [PATCH] reglage boutton sup inviter + Debut binding NOurriture --- ParionsCuite/ParionsCuite/MainPage.xaml | 2 +- ParionsCuite/ParionsCuite/MainPage.xaml.cs | 23 ++- ParionsCuite/ParionsCuite/ParionsCuite.csproj | 12 +- .../ParionsCuite/Views/Information/Info.xaml | 4 +- .../ParionsCuite/Views/Invite/Inviter.xaml.cs | 23 +-- .../Participations/NewFolder1/Nourri.xaml | 37 ++++ .../Participations/NewFolder1/Nourri.xaml.cs | 163 ++++++++++++++++++ .../Views/Participations/Nourriture.xaml | 66 ++----- .../Views/Participations/Nourriture.xaml.cs | 34 +++- 9 files changed, 282 insertions(+), 82 deletions(-) create mode 100644 ParionsCuite/ParionsCuite/Views/Participations/NewFolder1/Nourri.xaml create mode 100644 ParionsCuite/ParionsCuite/Views/Participations/NewFolder1/Nourri.xaml.cs diff --git a/ParionsCuite/ParionsCuite/MainPage.xaml b/ParionsCuite/ParionsCuite/MainPage.xaml index 02619a2..1583cb3 100644 --- a/ParionsCuite/ParionsCuite/MainPage.xaml +++ b/ParionsCuite/ParionsCuite/MainPage.xaml @@ -45,7 +45,7 @@ - + diff --git a/ParionsCuite/ParionsCuite/MainPage.xaml.cs b/ParionsCuite/ParionsCuite/MainPage.xaml.cs index 8b8e3a1..fa40c91 100644 --- a/ParionsCuite/ParionsCuite/MainPage.xaml.cs +++ b/ParionsCuite/ParionsCuite/MainPage.xaml.cs @@ -37,15 +37,14 @@ public partial class MainPage : ContentPage }; newButton.Clicked += (sender, e) => { - // Appeler la méthode qui récupère l'événement associé + // Appel de la méthode qui récupère l'événement associé SelectEvent(evenement); var newPage = new Views.Accueil(); - // Définissez le contenu de la ContentView sur la nouvelle page changeButton.Content = newPage; }; - // Ajouter le bouton au ButtonStackLayout + // Ajout du bouton au ButtonStackLayout ButtonStackLayout.Children.Add(newButton); ; } public void SelectEvent(Evenement evenement) @@ -61,49 +60,55 @@ public partial class MainPage : ContentPage + // Acces View Groupe public void Button_Clicked(object sender, EventArgs e) { var newPage = new Views.Groupe(); - // Définissez le contenu de la ContentView sur la nouvelle page changeButton.Content = newPage; } + // Acces view Invite private void InviteView(object sender, EventArgs e) { if (EventSelect == null) { return; } var newPage = new Views.Invite.Inviter(EventSelect); - // Définissez le contenu de la ContentView sur la nouvelle page changeButton.Content = newPage; } + // Acces view Participant private void ParticipantView(object sender, EventArgs e) { - var newPage = new Views.Participations.Nourriture(); + if (EventSelect == null) { return; } + + var newPage = new Views.Participations.Nourriture(EventSelect); - // Définissez le contenu de la ContentView sur la nouvelle page changeButton.Content = newPage; } + + //Acces View Pari private void PariView(object sender, EventArgs e) { + //if (EventSelect == null) { return; } + var newPage = new Views.Pari.Parier(); - // Définissez le contenu de la ContentView sur la nouvelle page changeButton.Content = newPage; } + + // Acces View Information private void InfoView(object sender, EventArgs e) { if (EventSelect == null) { return; } var newPage = new Views.Information.Info(EventSelect); - // Définissez le contenu de la ContentView sur la nouvelle page changeButton.Content = newPage; } diff --git a/ParionsCuite/ParionsCuite/ParionsCuite.csproj b/ParionsCuite/ParionsCuite/ParionsCuite.csproj index 78663ed..202f7a8 100644 --- a/ParionsCuite/ParionsCuite/ParionsCuite.csproj +++ b/ParionsCuite/ParionsCuite/ParionsCuite.csproj @@ -44,6 +44,14 @@ + + + + + + + + @@ -63,6 +71,9 @@ MSBuild:Compile + + MSBuild:Compile + @@ -82,7 +93,6 @@ - diff --git a/ParionsCuite/ParionsCuite/Views/Information/Info.xaml b/ParionsCuite/ParionsCuite/Views/Information/Info.xaml index 4bd039c..6f45c8f 100644 --- a/ParionsCuite/ParionsCuite/Views/Information/Info.xaml +++ b/ParionsCuite/ParionsCuite/Views/Information/Info.xaml @@ -4,11 +4,11 @@ x:Class="ParionsCuite.Views.Information.Info"> - + - + diff --git a/ParionsCuite/ParionsCuite/Views/Invite/Inviter.xaml.cs b/ParionsCuite/ParionsCuite/Views/Invite/Inviter.xaml.cs index 70e3eb8..b66c55e 100644 --- a/ParionsCuite/ParionsCuite/Views/Invite/Inviter.xaml.cs +++ b/ParionsCuite/ParionsCuite/Views/Invite/Inviter.xaml.cs @@ -23,7 +23,7 @@ public partial class Inviter : ContentView List listInvite = EventSelect.ListInviter; Debug.WriteLine(listInvite); - int len = listInvite.Count; + int len = 1; foreach (Modeles.Inviter inviter in listInvite) { RowDefinition row = new RowDefinition(); row.Height = new GridLength(45); @@ -48,14 +48,16 @@ public partial class Inviter : ContentView Button buttonMoins = new Button(); buttonMoins.Text = "-"; + buttonMoins.Clicked += BoutonSupprimer_Clicked; Grid.SetRow(buttonMoins, len); Grid.SetColumn(buttonMoins, 2); GrilleInvite.Children.Add(buttonMoins); len++; + Debug.WriteLine("Test test"); + } - Debug.WriteLine("Test test"); } private void AddInvitelist(object sender, EventArgs e) @@ -63,7 +65,7 @@ public partial class Inviter : ContentView //restoreListInvite(); string nom = nomEditor.Text; string prenom = prenomEditor.Text; - if (nom == null || prenom == null) { return; } + if (nom == null || prenom == null || nom == "" || prenom == "") { return; } Modeles.Inviter invite1 = new Modeles.Inviter(nom, prenom); EventSelect.ListInviter.Add(invite1); ; @@ -103,7 +105,11 @@ public partial class Inviter : ContentView //GrilleInvite.HeightRequest = Height + 2; len = len +1 ; + + } + prenomEditor.Text = ""; + nomEditor.Text = ""; } private void BoutonSupprimer_Clicked(object sender, EventArgs e) @@ -118,9 +124,7 @@ public partial class Inviter : ContentView int rowIndex = Grid.GetRow(button); // Vérifier que l'indice rowIndex est valide - if (rowIndex >= 0 && rowIndex < parentGrid.RowDefinitions.Count) - { - // Récupérer les labels correspondants à la ligne + Label prenomLabel = null; Label nomLabel = null; @@ -145,12 +149,12 @@ public partial class Inviter : ContentView string nom = nomLabel.Text; // Rechercher l'invité correspondant dans la liste - Modeles.Inviter inviter = mgr.ReturnListInvite().FirstOrDefault(i => i.Prenom == prenom && i.Nom == nom); + Modeles.Inviter inviter = EventSelect.ListInviter.FirstOrDefault(i => i.Prenom == prenom && i.Nom == nom); if (inviter != null) { - // Supprimer l'invité de la liste - mgr.RemoveInviter(inviter); + // Supprimer l'invité de la liste + EventSelect.ListInviter.Remove(inviter); // Supprimer les éléments de la ligne de la grille parentGrid.Children.Remove(prenomLabel); @@ -159,7 +163,6 @@ public partial class Inviter : ContentView parentGrid.RowDefinitions.RemoveAt(rowIndex); } } - } } } diff --git a/ParionsCuite/ParionsCuite/Views/Participations/NewFolder1/Nourri.xaml b/ParionsCuite/ParionsCuite/Views/Participations/NewFolder1/Nourri.xaml new file mode 100644 index 0000000..152e888 --- /dev/null +++ b/ParionsCuite/ParionsCuite/Views/Participations/NewFolder1/Nourri.xaml @@ -0,0 +1,37 @@ + + + + + + + + + +