Ajout documentatiob

pull/18/head
Leana BESSON 2 years ago
parent b1b9f49296
commit 56c1969beb

@ -1,31 +1,49 @@
/*! \file Animal.cs /*!
* \author Léana Besson * \file Animal.xaml.cs
* \author Léana Besson
*/ */
using Model; using Model;
/*! \namespace Views /*!
* \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 partial class Animaux : ContentPage
{ {
/*!
public Animaux() * \fn Animaux()
* \brief Animaux page constructor with component initialization and context binding assignment
*/
public Animaux()
{ {
InitializeComponent(); InitializeComponent();
BindingContext = (App.Current as App).Theque; 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) public void OnClick(object sender, ItemTappedEventArgs e)
{ {
(App.Current as App).AnimalSelectionner = e.Item as Animal; (App.Current as App).AnimalSelectionner = e.Item as Animal;
Navigation.PushAsync(new DetailAnimal()); 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).AnimalSelectionner = (App.Current as App).Theque.AjouterAnimal();
(App.Current as App).PageDeSaisie?.InitBinding(); (App.Current as App).PageDeSaisie?.InitBinding();

@ -1,15 +1,36 @@
using Model; /*!
* \file App.xaml.cs
* \author Léana Besson
*/
using Model;
using Persistance; using Persistance;
using System.ComponentModel; using System.ComponentModel;
using System.Runtime.CompilerServices;
/*!
* \namespace Views
*/
namespace Views namespace Views
{ {
/*!
* \class App
* \brief Regroups functions for App operation
*/
public partial class App : Application, INotifyPropertyChanged public partial class App : Application, INotifyPropertyChanged
{ {
/*!
* \param SerializationPath string - Path to AppDataDirectory folder for persistence
*/
public string SerializationPath = FileSystem.Current.AppDataDirectory; public string SerializationPath = FileSystem.Current.AppDataDirectory;
static private 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); public Theque Theque { get; set; } = DataSerializerBinary.Deserializer(serializationPath);
/*!
* \param AnimalSelectionner Animal - Contains user-selected animal data
*/
public Animal AnimalSelectionner public Animal AnimalSelectionner
{ {
get => animalSelectionner; get => animalSelectionner;
@ -21,10 +42,25 @@ namespace Views
} }
private Animal animalSelectionner; private Animal animalSelectionner;
public New_DetailAnimal PageDeSaisie { get; set; } /*!
* \param EspeceSelectionner Espece - Contains user-selected species data
*/
public Espece EspeceSelectionner { get; set; } public Espece EspeceSelectionner { get; set; }
/*!
* \param RaceSelectionner Race - Contains user-selected breed data
*/
public Race RaceSelectionner { get; set; } 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() public App()
{ {
InitializeComponent(); InitializeComponent();

@ -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 public partial class AppShell : Shell
{ {
/*!
* \fn AppShell()
* \brief Application builder with component initialization
*/
public AppShell() public AppShell()
{ {
InitializeComponent(); InitializeComponent();

@ -1,11 +1,26 @@
/*!
* \file Animal.xaml.cs
* \author Léana Besson
*/
using Model; using Model;
using Persistance; using Persistance;
/*!
* \namespace Views
*/
namespace Views; namespace Views;
/*!
* \class DetailAnimal
* \brief Regroups functions for DetailAnimal page operation
*/
public partial class DetailAnimal : ContentPage public partial class DetailAnimal : ContentPage
{ {
public DetailAnimal() /*!
* \fn AppShell()
* \brief Animaux page constructor with component initialization and context binding assignment
*/
public DetailAnimal()
{ {
InitializeComponent(); InitializeComponent();
BindingContext = (App.Current as App).AnimalSelectionner; 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) public async void Button_OnClick(object sender, EventArgs e)
{ {
(App.Current as App).Theque.SupprimerAnimal((App.Current as App).AnimalSelectionner); (App.Current as App).Theque.SupprimerAnimal((App.Current as App).AnimalSelectionner);

@ -24,7 +24,7 @@ public partial class New_DetailAnimal : ContentPage
public async void Button_OnClick(object sender, EventArgs e) public async void Button_OnClick(object sender, EventArgs e)
{ {
(App.Current as App).Theque.SupprimerAnimal((App.Current as App).AnimalSelectionner); (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"); await Shell.Current.GoToAsync("//Animaux");
} }
@ -32,7 +32,7 @@ public partial class New_DetailAnimal : ContentPage
{ {
if ((App.Current as App).AnimalSelectionner.NomIsValid == true) 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"); await Shell.Current.GoToAsync("//Animaux");
} }
} }

Loading…
Cancel
Save