fix test year pour l'ajout d'un jeu + fix bug de navigation

Popup_qui_marche_pas
Anthony RICHARD 2 years ago
parent b940af0596
commit b414cd9a92

@ -5,6 +5,7 @@
x:Class="Stim.AddGamePage"
Title="Ajouter un jeu"
Background="{StaticResource Secondary}">
<ScrollView>
<Grid>
<Grid.ColumnDefinitions>
@ -41,7 +42,6 @@
</VerticalStackLayout>
<VerticalStackLayout Grid.Column="1" Grid.Row="3" Padding="0,150,0,0">
<Label Text="Jaquette" FontSize="30" HorizontalOptions="Center"/>
<!-- Please faut commenter quand y'a des trucs à implémenter ou alors faire un ticket-->
<Button Margin="5" Clicked="Button_Clicked"/>
</VerticalStackLayout>
<VerticalStackLayout Grid.Column="1" Grid.Row="4" Padding="0,150,0,0">

@ -21,19 +21,19 @@ public partial class AddGamePage : ContentPage
string message = "";
if (string.IsNullOrEmpty(NameEntry.Text)) message += "Nom invalide\n";
if (string.IsNullOrEmpty(DescriptionEntry.Text)) message += "Description invalide\n";
if (string.IsNullOrEmpty(YearEntry.Text) || !int.TryParse(YearEntry.Text, out year)) message += "Année invalide\n";
if (string.IsNullOrEmpty(YearEntry.Text) || !int.TryParse(YearEntry.Text, out year) || year < 1957 || year > 2023) message += "Année invalide\n";
if (string.IsNullOrEmpty(LinkEntry.Text)) message += "Lien invalide\n";
if (!string.IsNullOrEmpty(NameEntry.Text) && !string.IsNullOrEmpty(DescriptionEntry.Text) && !string.IsNullOrEmpty(YearEntry.Text) && int.TryParse(YearEntry.Text, out year) && !string.IsNullOrWhiteSpace(LinkEntry.Text) /*|| _ImgPath is null*/)
if (message == "" && int.TryParse(YearEntry.Text, out year))
{
Game game = new(NameEntry.Text, DescriptionEntry.Text, year, new List<string> { TagEntry1.Text, TagEntry2.Text, TagEntry3.Text }, imgName, LinkEntry.Text);
if ((App.Current as App).Manager.GameList.Contains(game)) message = "Jeu déjà existant\n";
else
{
message = "Jeu ajouté !";
((App)App.Current).Manager.AddGametoGamesList(new Game(NameEntry.Text, DescriptionEntry.Text, year, new List<string> { TagEntry1.Text, TagEntry2.Text, TagEntry3.Text }, imgName, LinkEntry.Text));
await this.ShowPopupAsync(new MessagePopup(message));
await Navigation.PopModalAsync();
((App)App.Current).Manager.SaveGames();
((App)App.Current).Manager.AddGametoGamesList(game);
await Navigation.PopAsync();
}
}
// //if (_ImgPath!=null) NameEntry.Text + ".png";
// //System.IO.File.Copy(_ImgPath, /**/, true);
await this.ShowPopupAsync(new MessagePopup(message));
}

@ -23,9 +23,9 @@ public partial class MainPage : ContentPage
await Navigation.PushAsync(new DetailledPage());
}
private async void GoToAddGamePage(object sender, EventArgs e)
private async void Addgame(object sender, EventArgs e)
{
await Navigation.PushModalAsync(new AddGamePage());
await Navigation.PushAsync(new AddGamePage());
}
private void SearchBar_GameChanged(object sender, TextChangedEventArgs e)

Loading…
Cancel
Save