Fonction AddGame

Popup_qui_marche_pas
Anthony RICHARD 2 years ago
parent 5638e4c72c
commit e23b6331ba

@ -0,0 +1,22 @@
using Model;
namespace Stim;
public partial class AddGamePage : ContentPage
{
public Manager Manager { get; set; }
public AddGamePage(Manager Mgr)
{
InitializeComponent();
Manager = Mgr;
}
private void AddGame(object sender, EventArgs e)
{
//faut rajouter des tests
string tag1 = TagEntry1.Text;
string tag2 = TagEntry2.Text;
string tag3 = TagEntry3.Text;
Manager.AddGametoGamesList(new Game(NameEntry.Text, DescriptionEntry.Text, int.Parse(YearEntry.Text), new List<string> { tag1, tag2, tag3 }, "null"));
}
}

@ -19,4 +19,9 @@ public partial class MainPage : ContentPage
{
await Navigation.PushAsync(new DetailledPage((sender as CollectionView).SelectedItem as Game));
}
private async void GoToAddGamePage(object sender, EventArgs e)
{
await Navigation.PushAsync(new AddGamePage(Manager));
}
}

@ -57,6 +57,9 @@
</ItemGroup>
<ItemGroup>
<MauiXaml Update="AddGamePage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="DetailledPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>

@ -1,13 +1,12 @@
using Model;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using System.Xml;
namespace StimStub
{
public class Stub : IPersistance
{
public readonly ObservableCollection<Game> games = new();
public Stub()
{
SaveGame(games);

Loading…
Cancel
Save