Ajout d'un jeu à la gameList (il manque juste la cover normalement)

Popup_qui_marche_pas
Anthony RICHARD 2 years ago
parent 336ccda5bb
commit 3ade9abc80

@ -19,10 +19,11 @@
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="0"/>
<VerticalStackLayout Background="{StaticResource Tertiary}" Grid.Column="1" Grid.RowSpan="6"/>
<VerticalStackLayout Background="{StaticResource Tertiary}" Grid.Column="1" Grid.RowSpan="7"/>
<VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="4"/>
<VerticalStackLayout Grid.Column="1">
@ -58,7 +59,8 @@
<Entry Grid.Row="1" Grid.Column="1" x:Name="TagEntry2"/>
<Entry Grid.Row="1" Grid.Column="2" x:Name="TagEntry3"/>
</Grid>
<Entry Grid.Row="5" Grid.Column="1" x:Name="LinkEntry"/>
</VerticalStackLayout>
<Button HorizontalOptions="Center" VerticalOptions="Center" Grid.Row="5" Grid.Column="1" Margin="5" FontSize="30" Text="Ajouter" Background="transparent" BorderWidth="3" BorderColor="{StaticResource Secondary}" Clicked="AddGame"/>
<Button HorizontalOptions="Center" VerticalOptions="Center" Grid.Row="6" Grid.Column="1" Margin="5" FontSize="30" Text="Ajouter" Background="transparent" BorderWidth="3" BorderColor="{StaticResource Secondary}" Clicked="AddGame"/>
</Grid>
</ContentPage>

@ -5,6 +5,7 @@ namespace Stim;
public partial class AddGamePage : ContentPage
{
public Manager Manager { get; set; }
public AddGamePage(Manager Mgr)
{
InitializeComponent();
@ -13,10 +14,10 @@ public partial class AddGamePage : ContentPage
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", "www.link.com"));
int year;
if (string.IsNullOrEmpty(NameEntry.Text) || string.IsNullOrEmpty(DescriptionEntry.Text) || string.IsNullOrEmpty(YearEntry.Text) || !int.TryParse(YearEntry.Text, out year) || string.IsNullOrWhiteSpace(LinkEntry.Text)) return;
Manager.AddGametoGamesList(new Game(NameEntry.Text, DescriptionEntry.Text, year, new List<string> { TagEntry1.Text, TagEntry2.Text, TagEntry3.Text }, "nyancat.png", LinkEntry.Text));
Navigation.RemovePage(this);
}
}
Loading…
Cancel
Save