feat : Add page embellish & img pickup, not currently working
continuous-integration/drone/push Build is passing Details

Popup_qui_marche_pas
Jade VAN BRABANDT 2 years ago
parent f177b1521a
commit 8b2d58fd04

@ -41,7 +41,7 @@
<VerticalStackLayout Grid.Column="1" Grid.Row="3" Padding="0,150,0,0"> <VerticalStackLayout Grid.Column="1" Grid.Row="3" Padding="0,150,0,0">
<Label Text="Jaquette" FontSize="30" HorizontalOptions="Center"/> <Label Text="Jaquette" FontSize="30" HorizontalOptions="Center"/>
<!-- Please faut commenter quand y'a des trucs à implémenter ou alors faire un ticket--> <!-- Please faut commenter quand y'a des trucs à implémenter ou alors faire un ticket-->
<Button Margin="5"/> <Button Margin="5" Clicked="Button_Clicked"/>
</VerticalStackLayout> </VerticalStackLayout>
<VerticalStackLayout Grid.Column="1" Grid.Row="4" Padding="0,150,0,0"> <VerticalStackLayout Grid.Column="1" Grid.Row="4" Padding="0,150,0,0">
<Grid> <Grid>
@ -62,6 +62,6 @@
</Grid> </Grid>
<Entry Grid.Row="5" Grid.Column="1" x:Name="LinkEntry"/> <Entry Grid.Row="5" Grid.Column="1" x:Name="LinkEntry"/>
</VerticalStackLayout> </VerticalStackLayout>
<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"/> <Button HorizontalOptions="Center" VerticalOptions="Center" Grid.Row="6" Grid.Column="1" Margin="5" FontSize="30" Text="Ajouter" Background="{StaticResource Grat200}" BorderWidth="3" BorderColor="{StaticResource Secondary}" Clicked="AddGame"/>
</Grid> </Grid>
</ContentPage> </ContentPage>

@ -1,4 +1,6 @@
using Model; using Model;
using Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific;
using Application = Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific.Application;
namespace Stim; namespace Stim;
@ -9,12 +11,22 @@ public partial class AddGamePage : ContentPage
InitializeComponent(); InitializeComponent();
} }
private void AddGame(object sender, EventArgs e) private string? _ImgPath;
private void AddGame(object sender, EventArgs e)
{ {
int year; 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; 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) return;
string imgName = NameEntry.Text + ".png";
((App)App.Current).Manager.AddGametoGamesList(new Game(NameEntry.Text, DescriptionEntry.Text, year, new List<string> { TagEntry1.Text, TagEntry2.Text, TagEntry3.Text }, "nyancat.png", LinkEntry.Text)); //System.IO.File.Copy(_ImgPath, /**/, true);
((App)App.Current).Manager.AddGametoGamesList(new Game(NameEntry.Text, DescriptionEntry.Text, year, new List<string> { TagEntry1.Text, TagEntry2.Text, TagEntry3.Text }, imgName, LinkEntry.Text));
Navigation.RemovePage(this); Navigation.RemovePage(this);
} }
private async void Button_Clicked(object sender, EventArgs e)
{
var ImgTask = await FilePicker.Default.PickAsync(null);
_ImgPath = ImgTask.FullPath;
}
} }

@ -3,7 +3,6 @@ using Model;
using StimPersistance; using StimPersistance;
using StimStub; using StimStub;
using Microsoft.Maui.Storage; using Microsoft.Maui.Storage;
using Windows.System;
public partial class MainPage : ContentPage public partial class MainPage : ContentPage
{ {

Loading…
Cancel
Save