From e23b6331ba43c4060574e30cac3d0ef09a4d49dc Mon Sep 17 00:00:00 2001 From: Anthony RICHARD Date: Tue, 23 May 2023 19:30:58 +0200 Subject: [PATCH] Fonction AddGame --- Sources/Stim/AddGamePage.xaml.cs | 22 ++++++++++++++++++++++ Sources/Stim/MainPage.xaml.cs | 5 +++++ Sources/Stim/Stim.csproj | 3 +++ Sources/Stub/Stub.cs | 3 +-- 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 Sources/Stim/AddGamePage.xaml.cs diff --git a/Sources/Stim/AddGamePage.xaml.cs b/Sources/Stim/AddGamePage.xaml.cs new file mode 100644 index 0000000..63170f1 --- /dev/null +++ b/Sources/Stim/AddGamePage.xaml.cs @@ -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 { tag1, tag2, tag3 }, "null")); + } +} \ No newline at end of file diff --git a/Sources/Stim/MainPage.xaml.cs b/Sources/Stim/MainPage.xaml.cs index a670ecb..8383a66 100644 --- a/Sources/Stim/MainPage.xaml.cs +++ b/Sources/Stim/MainPage.xaml.cs @@ -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)); + } } diff --git a/Sources/Stim/Stim.csproj b/Sources/Stim/Stim.csproj index 01c1343..d5286c8 100644 --- a/Sources/Stim/Stim.csproj +++ b/Sources/Stim/Stim.csproj @@ -57,6 +57,9 @@ + + MSBuild:Compile + MSBuild:Compile diff --git a/Sources/Stub/Stub.cs b/Sources/Stub/Stub.cs index 87bc8ea..0a51941 100644 --- a/Sources/Stub/Stub.cs +++ b/Sources/Stub/Stub.cs @@ -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 games = new(); + public Stub() { SaveGame(games);