diff --git a/Sources/Views/Animaux.xaml.cs b/Sources/Views/Animaux.xaml.cs index 93b685e..5821145 100644 --- a/Sources/Views/Animaux.xaml.cs +++ b/Sources/Views/Animaux.xaml.cs @@ -1,31 +1,49 @@ -/*! \file Animal.cs - * \author Léana Besson +/*! + * \file Animal.xaml.cs + * \author Léana Besson */ using Model; -/*! \namespace Views +/*! + * \namespace Views */ namespace Views; -/*! \class Animaux - * \brief +/*! + * \class Animaux + * \brief Regroups functions for the proper operation of the Pets page */ public partial class Animaux : ContentPage { - - public Animaux() + /*! + * \fn Animaux() + * \brief Animaux page constructor with component initialization and context binding assignment + */ + public Animaux() { InitializeComponent(); BindingContext = (App.Current as App).Theque; } + /*! + * \fn OnClick(object sender, ItemTappedEventArgs e) + * \brief Saves the pet selected by the user and opens a new DetailAnimal page + * \param sender object - Event emitter information, namely the Animaux.xaml page + * \param e ItemTappedEventArgs - Information on selected pet + */ public void OnClick(object sender, ItemTappedEventArgs e) { (App.Current as App).AnimalSelectionner = e.Item as Animal; Navigation.PushAsync(new DetailAnimal()); } - public async void Button_OnClick(object sender, EventArgs e) + /*! + * \fn Button_OnClick(object sender, EventArgs e) + * \brief Adds an pet to the theque and opens the pet's data entry page + * \param sender object - Event emitter information, namely the Animals.xaml page + * \param e EventArgs - Information related to the clicked button event + */ + public async void Button_OnClick(object sender, EventArgs e) { (App.Current as App).AnimalSelectionner = (App.Current as App).Theque.AjouterAnimal(); (App.Current as App).PageDeSaisie?.InitBinding(); diff --git a/Sources/Views/App.xaml.cs b/Sources/Views/App.xaml.cs index 2c76e30..b0705a4 100644 --- a/Sources/Views/App.xaml.cs +++ b/Sources/Views/App.xaml.cs @@ -1,15 +1,36 @@ -using Model; +/*! + * \file App.xaml.cs + * \author Léana Besson + */ +using Model; using Persistance; using System.ComponentModel; -using System.Runtime.CompilerServices; +/*! + * \namespace Views + */ namespace Views { + /*! + * \class App + * \brief Regroups functions for App operation + */ public partial class App : Application, INotifyPropertyChanged { + /*! + * \param SerializationPath string - Path to AppDataDirectory folder for persistence + */ public string SerializationPath = FileSystem.Current.AppDataDirectory; static private string serializationPath = FileSystem.Current.AppDataDirectory; + + /*! + * \param theque Theque - Contains all data on Species and Pets + */ public Theque Theque { get; set; } = DataSerializerBinary.Deserializer(serializationPath); + + /*! + * \param AnimalSelectionner Animal - Contains user-selected animal data + */ public Animal AnimalSelectionner { get => animalSelectionner; @@ -21,10 +42,25 @@ namespace Views } private Animal animalSelectionner; - public New_DetailAnimal PageDeSaisie { get; set; } + /*! + * \param EspeceSelectionner Espece - Contains user-selected species data + */ public Espece EspeceSelectionner { get; set; } + + /*! + * \param RaceSelectionner Race - Contains user-selected breed data + */ public Race RaceSelectionner { get; set; } + /*! + * \param PageDeSaisie New_DetailAnimal - + */ + public New_DetailAnimal PageDeSaisie { get; set; } + + /*! + * \fn App() + * \brief App constructor with component initialization and creation of a new AppShell + */ public App() { InitializeComponent(); diff --git a/Sources/Views/AppShell.xaml.cs b/Sources/Views/AppShell.xaml.cs index c87e1de..a6a040f 100644 --- a/Sources/Views/AppShell.xaml.cs +++ b/Sources/Views/AppShell.xaml.cs @@ -1,7 +1,20 @@ -namespace Views +/*! + * \file AppShell.xaml.cs + * \author Léana Besson + * \namespace Views + */ +namespace Views { + /*! + * \class Animaux + * \brief Regroups functions for AppShell operation + */ public partial class AppShell : Shell { + /*! + * \fn AppShell() + * \brief Application builder with component initialization + */ public AppShell() { InitializeComponent(); diff --git a/Sources/Views/DetailAnimal.xaml.cs b/Sources/Views/DetailAnimal.xaml.cs index bcfe555..c943201 100644 --- a/Sources/Views/DetailAnimal.xaml.cs +++ b/Sources/Views/DetailAnimal.xaml.cs @@ -1,11 +1,26 @@ +/*! + * \file Animal.xaml.cs + * \author Léana Besson + */ using Model; using Persistance; +/*! + * \namespace Views + */ namespace Views; +/*! + * \class DetailAnimal + * \brief Regroups functions for DetailAnimal page operation + */ public partial class DetailAnimal : ContentPage { - public DetailAnimal() + /*! + * \fn AppShell() + * \brief Animaux page constructor with component initialization and context binding assignment + */ + public DetailAnimal() { InitializeComponent(); BindingContext = (App.Current as App).AnimalSelectionner; @@ -20,6 +35,12 @@ public partial class DetailAnimal : ContentPage } } + /*! + * \fn Button_OnClick(object sender, EventArgs e) + * \brief Delete the animal from the theque, serialize the theque and go to the Animaux page + * \param sender object - Event emitter information, namely the DetailAnimal.xaml page + * \param e EventArgs - Information related to the clicked button event + */ public async void Button_OnClick(object sender, EventArgs e) { (App.Current as App).Theque.SupprimerAnimal((App.Current as App).AnimalSelectionner); diff --git a/Sources/Views/New_DetailAnimal.xaml.cs b/Sources/Views/New_DetailAnimal.xaml.cs index 262ab4d..7a7f02f 100644 --- a/Sources/Views/New_DetailAnimal.xaml.cs +++ b/Sources/Views/New_DetailAnimal.xaml.cs @@ -24,7 +24,7 @@ public partial class New_DetailAnimal : ContentPage public async void Button_OnClick(object sender, EventArgs e) { (App.Current as App).Theque.SupprimerAnimal((App.Current as App).AnimalSelectionner); - DataSerializerJson.Serializer((App.Current as App).SerializationPath, (App.Current as App).Theque); + DataSerializerBinary.Serializer((App.Current as App).SerializationPath, (App.Current as App).Theque); await Shell.Current.GoToAsync("//Animaux"); } @@ -32,7 +32,7 @@ public partial class New_DetailAnimal : ContentPage { if ((App.Current as App).AnimalSelectionner.NomIsValid == true) { - DataSerializerJson.Serializer((App.Current as App).SerializationPath, (App.Current as App).Theque); + DataSerializerBinary.Serializer((App.Current as App).SerializationPath, (App.Current as App).Theque); await Shell.Current.GoToAsync("//Animaux"); } }