You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.5 KiB
57 lines
1.5 KiB
using Model.Classes;
|
|
using Model.Managers;
|
|
|
|
namespace Ohara;
|
|
|
|
public partial class ModalFDD : ContentPage
|
|
{
|
|
public Manager manager => (App.Current as App).manager;
|
|
public FruitDuDemon nouveauFdd;
|
|
public string ancienNom;
|
|
public ModalFDD()
|
|
{
|
|
if (manager.SelectedItem != null)
|
|
{
|
|
nouveauFdd = manager.SelectedItem as FruitDuDemon;
|
|
ancienNom = nouveauFdd.Nom;
|
|
}
|
|
else
|
|
{
|
|
nouveauFdd = new FruitDuDemon("Fruit", " ", " ",0,0, " "," ","");
|
|
}
|
|
InitializeComponent();
|
|
BindingContext = nouveauFdd;
|
|
}
|
|
|
|
private async void ButtonConfirmer_Clicked(object sender, EventArgs e)
|
|
{
|
|
if (manager.SelectedItem != null)
|
|
{
|
|
manager.ModifierFDD(nouveauFdd, ancienNom);
|
|
nouveauFdd = manager.SelectedItem as FruitDuDemon;
|
|
}
|
|
else
|
|
{
|
|
manager.AjouterFDD(nouveauFdd);
|
|
}
|
|
|
|
await Navigation.PopModalAsync();
|
|
}
|
|
private async void ButtonAnnuler_Clicked(object sender, EventArgs e)
|
|
{
|
|
await Navigation.PopModalAsync();
|
|
}
|
|
private async void ButtonImage_Clicked(object sender, EventArgs e)
|
|
{
|
|
var result = await FilePicker.PickAsync(new PickOptions
|
|
{
|
|
PickerTitle = "Choisissez une image ...",
|
|
FileTypes = FilePickerFileType.Images,
|
|
});
|
|
if (result != null)
|
|
{
|
|
var stream = result.FullPath;
|
|
nouveauFdd.Image = stream;
|
|
}
|
|
}
|
|
} |