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="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="0"/> <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 BackgroundColor="{StaticResource Secondary}" Grid.Column="4"/>
<VerticalStackLayout Grid.Column="1"> <VerticalStackLayout Grid.Column="1">
@ -58,7 +59,8 @@
<Entry Grid.Row="1" Grid.Column="1" x:Name="TagEntry2"/> <Entry Grid.Row="1" Grid.Column="1" x:Name="TagEntry2"/>
<Entry Grid.Row="1" Grid.Column="2" x:Name="TagEntry3"/> <Entry Grid.Row="1" Grid.Column="2" x:Name="TagEntry3"/>
</Grid> </Grid>
<Entry Grid.Row="5" Grid.Column="1" x:Name="LinkEntry"/>
</VerticalStackLayout> </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> </Grid>
</ContentPage> </ContentPage>

@ -5,6 +5,7 @@ namespace Stim;
public partial class AddGamePage : ContentPage public partial class AddGamePage : ContentPage
{ {
public Manager Manager { get; set; } public Manager Manager { get; set; }
public AddGamePage(Manager Mgr) public AddGamePage(Manager Mgr)
{ {
InitializeComponent(); InitializeComponent();
@ -13,10 +14,10 @@ public partial class AddGamePage : ContentPage
private void AddGame(object sender, EventArgs e) private void AddGame(object sender, EventArgs e)
{ {
//faut rajouter des tests int year;
string tag1 = TagEntry1.Text; if (string.IsNullOrEmpty(NameEntry.Text) || string.IsNullOrEmpty(DescriptionEntry.Text) || string.IsNullOrEmpty(YearEntry.Text) || !int.TryParse(YearEntry.Text, out year) || string.IsNullOrWhiteSpace(LinkEntry.Text)) return;
string tag2 = TagEntry2.Text;
string tag3 = TagEntry3.Text; Manager.AddGametoGamesList(new Game(NameEntry.Text, DescriptionEntry.Text, year, new List<string> { TagEntry1.Text, TagEntry2.Text, TagEntry3.Text }, "nyancat.png", LinkEntry.Text));
Manager.AddGametoGamesList(new Game(NameEntry.Text, DescriptionEntry.Text, int.Parse(YearEntry.Text), new List<string> { tag1, tag2, tag3 }, "null", "www.link.com")); Navigation.RemovePage(this);
} }
} }
Loading…
Cancel
Save