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 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ParionsCuite/ParionsCuite/Views/Participations/NewFolder1/Nourri.xaml.cs b/ParionsCuite/ParionsCuite/Views/Participations/NewFolder1/Nourri.xaml.cs
new file mode 100644
index 0000000..fda0f40
--- /dev/null
+++ b/ParionsCuite/ParionsCuite/Views/Participations/NewFolder1/Nourri.xaml.cs
@@ -0,0 +1,163 @@
+using ParionsCuite.Modeles;
+using ParionsCuite.Views.Participations;
+using System.Diagnostics;
+
+namespace ParionsCuite.Views.Participations.NewFolder1;
+
+public partial class Nourri : ContentView
+{
+ readonly Evenement EventSelect;
+
+ public Manageur mgr => (App.Current as App).MyManager;
+
+ public Nourri(Evenement EventSelect)
+ {
+ this.EventSelect = EventSelect;
+ InitializeComponent();
+ //restoreListInvite(EventSelect);
+ BindingContext = this;
+ }
+
+
+ public void restoreListInvite(Evenement EventSelect)
+ {
+
+ var listFood = EventSelect.Participation.Nourriture;
+ Debug.WriteLine(listFood);
+ int len = 1;
+ foreach (Modeles.Nourriture food in listFood)
+ {
+ RowDefinition row = new RowDefinition();
+ row.Height = new GridLength(45);
+ GridFood.RowDefinitions.Add(row);
+
+ // AJout Prenom
+ Label foodLabel = new Label();
+ foodLabel.Text = food.Nom;
+ Grid.SetRow(foodLabel, len);
+ Grid.SetColumn(foodLabel, 0);
+ GridFood.Children.Add(foodLabel);
+
+
+ // Ajout Nom
+ Label qteLabel = new Label();
+ food.Nom = food.Quantite.ToString();
+ Grid.SetRow(qteLabel, len);
+ Grid.SetColumn(qteLabel, 1);
+ GridFood.Children.Add(qteLabel);
+
+ // Ajout Bouton
+
+ Button buttonMoins = new Button();
+ buttonMoins.Text = "-";
+ buttonMoins.Clicked += BoutonSupprimer_Clicked;
+ Grid.SetRow(buttonMoins, len);
+ Grid.SetColumn(buttonMoins, 2);
+ GridFood.Children.Add(buttonMoins);
+
+ len++;
+ Debug.WriteLine("Test test");
+
+ }
+
+ }
+
+ private void AddFoodlist(object sender, EventArgs e)
+ {
+ //restoreListInvite();
+ string food = FoodInput.Text;
+ string qte = QteInput.Text;
+ if (food == null || qte == null) { return; }
+ Modeles.Nourriture food1 = new Modeles.Nourriture(food, Int32.Parse(qte));
+ EventSelect.Participation.Nourriture.Add(food1);
+ int len = 1;
+ //if (len == 0 ) { len = 1; }
+ foreach (Modeles.Nourriture food2 in EventSelect.Participation.Nourriture)
+ {
+ RowDefinition row = new RowDefinition();
+ row.Height = new GridLength(45);
+ GridFood.RowDefinitions.Add(row);
+
+ // AJout Prenom
+ Label foodLabel = new Label();
+ foodLabel.Text = food2.Nom;
+ Grid.SetRow(foodLabel, len);
+ Grid.SetColumn(foodLabel, 0);
+ GridFood.Children.Add(foodLabel);
+
+
+ // Ajout Nom
+ Label qteLabel = new Label();
+ food2.Nom = food2.Quantite.ToString();
+ Grid.SetRow(qteLabel, len);
+ Grid.SetColumn(qteLabel, 1);
+ GridFood.Children.Add(qteLabel);
+
+ // Ajout Bouton
+
+ Button buttonMoins = new Button();
+ buttonMoins.Text = "-";
+ buttonMoins.Clicked += BoutonSupprimer_Clicked;
+ Grid.SetRow(buttonMoins, len);
+ Grid.SetColumn(buttonMoins, 2);
+ GridFood.Children.Add(buttonMoins);
+
+ len++;
+ Debug.WriteLine("Test test");
+ }
+
+ }
+
+ private void BoutonSupprimer_Clicked(object sender, EventArgs e)
+ {
+ // Récupérer le bouton cliqué
+ Button button = (Button)sender;
+
+ // Récupérer la grille parente du bouton
+ Grid parentGrid = (Grid)button.Parent;
+
+ // Récupérer la ligne parente du bouton
+ int rowIndex = Grid.GetRow(button);
+
+ // Vérifier que l'indice rowIndex est valide
+
+ Label prenomLabel = null;
+ Label nomLabel = null;
+
+ // Parcourir les enfants de la grille pour trouver les labels de la ligne
+ foreach (View child in parentGrid.Children)
+ {
+ int childRowIndex = Grid.GetRow(child);
+
+ if (childRowIndex == rowIndex)
+ {
+ if (Grid.GetColumn(child) == 0)
+ prenomLabel = (Label)child;
+ else if (Grid.GetColumn(child) == 1)
+ nomLabel = (Label)child;
+ }
+ }
+
+ if (prenomLabel != null && nomLabel != null)
+ {
+ // Récupérer le prénom et le nom de l'invité à supprimer
+ string prenom = prenomLabel.Text;
+ string nom = nomLabel.Text;
+
+ // Rechercher l'invité correspondant dans la liste
+ Modeles.Inviter inviter = EventSelect.ListInviter.FirstOrDefault(i => i.Prenom == prenom && i.Nom == nom);
+
+ if (inviter != null)
+ {
+ // Supprimer l'invité de la liste
+ EventSelect.ListInviter.Remove(inviter);
+
+ // Supprimer les éléments de la ligne de la grille
+ parentGrid.Children.Remove(prenomLabel);
+ parentGrid.Children.Remove(nomLabel);
+ parentGrid.Children.Remove(button);
+ parentGrid.RowDefinitions.RemoveAt(rowIndex);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ParionsCuite/ParionsCuite/Views/Participations/Nourriture.xaml b/ParionsCuite/ParionsCuite/Views/Participations/Nourriture.xaml
index bf1734c..ce72971 100644
--- a/ParionsCuite/ParionsCuite/Views/Participations/Nourriture.xaml
+++ b/ParionsCuite/ParionsCuite/Views/Participations/Nourriture.xaml
@@ -2,68 +2,26 @@
+ x:Class="ParionsCuite.Views.Participations.Nourriture"
+ xmlns:nourriture="clr-namespace:ParionsCuite.Views.Participations.NewFolder1"
+>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
+
+
-
+
+
+
diff --git a/ParionsCuite/ParionsCuite/Views/Participations/Nourriture.xaml.cs b/ParionsCuite/ParionsCuite/Views/Participations/Nourriture.xaml.cs
index 8b764b2..bd80c6b 100644
--- a/ParionsCuite/ParionsCuite/Views/Participations/Nourriture.xaml.cs
+++ b/ParionsCuite/ParionsCuite/Views/Participations/Nourriture.xaml.cs
@@ -1,19 +1,43 @@
using ParionsCuite.Modeles;
+using ParionsCuite.Views.Participations;
namespace ParionsCuite.Views.Participations;
public partial class Nourriture : ContentView
{
- public Manageur Mng => (App.Current as App).MyManager;
+ public Manageur mgr => (App.Current as App).MyManager;
- public Nourriture()
+ Evenement EventSelect;
+ public Nourriture(Evenement EventSelect)
{
- BindingContext = Mng.Evenement[0].Participation;
- InitializeComponent();
+ InitializeComponent();
+ this.EventSelect = EventSelect;
}
- private void AjoutNourriture(object sender, EventArgs e)
+ private void NourritureView(object sender, EventArgs e)
{
+ if (EventSelect == null) { return; }
+ var newPage = new Views.Participations.NewFolder1.Nourri(EventSelect);
+
+ changeButton.Content = newPage;
+ }
+
+ private void BoissonView(object sender, EventArgs e)
+ {
+ if (EventSelect == null) { return; }
+
+ var newPage = new Views.Participations.NewFolder1.Nourri(EventSelect);
+
+ changeButton.Content = newPage;
+ }
+
+ private void AutreView(object sender, EventArgs e)
+ {
+ if (EventSelect == null) { return; }
+
+ var newPage = new Views.Participations.NewFolder1.Nourri(EventSelect);
+
+ changeButton.Content = newPage;
}
}