Ajout barre de navigation et du bouton ajouter jeu dans la MainPage
continuous-integration/drone/push Build is failing Details

Popup_qui_marche_pas
Anthony RICHARD 2 years ago
parent 1cf670f2a2
commit 5638e4c72c

@ -4,21 +4,25 @@ namespace Model
{ {
public class Manager public class Manager
{ {
public IPersistance _persistance;
public ObservableCollection<Game> GameList { get;} public ObservableCollection<Game> GameList { get;}
public Manager(IPersistance persistance) public Manager(IPersistance persistance)
{ {
_persistance = persistance;
GameList = persistance.LoadGame(); GameList = persistance.LoadGame();
} }
public void AddGametoGamesList(Game game) public void AddGametoGamesList(Game game)
{ {
GameList.Add(game); GameList.Add(game);
_persistance.SaveGame(GameList);
} }
public void RemoveGameFromGamesList(Game game) public void RemoveGameFromGamesList(Game game)
{ {
GameList.Remove(game); GameList.Remove(game);
_persistance.SaveGame(GameList);
} }
} }
} }

@ -21,14 +21,14 @@ public partial class DetailledPage : ContentPage
AddStars(layout, rev.Rate); AddStars(layout, rev.Rate);
} }
private void AddStars(HorizontalStackLayout container, float rate) private static void AddStars(HorizontalStackLayout container, float rate)
{ {
for (int i = 0; i < (int)rate; i++) container.Children.Add(new Image { Source = "etoile_pleine.png", WidthRequest = 30 }); for (int i = 0; i < (int)rate; i++) container.Children.Add(new Image { Source = "etoile_pleine.png", WidthRequest = 30 });
if ((int)rate != rate) container.Children.Add(new Image { Source = "etoile_mi_pleine.png", WidthRequest = 30 }); if ((int)rate != rate) container.Children.Add(new Image { Source = "etoile_mi_pleine.png", WidthRequest = 30 });
while (container.Children.Count != 6) container.Children.Add(new Image { Source = "etoile_vide.png", WidthRequest = 30 }); while (container.Children.Count != 6) container.Children.Add(new Image { Source = "etoile_vide.png", WidthRequest = 30 });
} }
private async void goToMainPage(object sender, EventArgs e) private async void GoToMainPage(object sender, EventArgs e)
{ {
await Navigation.PushModalAsync(new MainPage()); await Navigation.PushModalAsync(new MainPage());
} }

@ -4,63 +4,84 @@
x:Class="Stim.MainPage" x:Class="Stim.MainPage"
Title="Accueil" Title="Accueil"
Background="{StaticResource Secondary}"> Background="{StaticResource Secondary}">
<Grid>
<ScrollView> <Grid.RowDefinitions>
<Grid BackgroundColor="{StaticResource Tertiary}"> <RowDefinition Height="*" />
<Grid.ColumnDefinitions> </Grid.RowDefinitions>
<ColumnDefinition Width="*"/> <ScrollView>
<ColumnDefinition Width="10*"/> <Grid BackgroundColor="{StaticResource Tertiary}">
<ColumnDefinition Width="*"/> <Grid.ColumnDefinitions>
</Grid.ColumnDefinitions> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="auto"/> <RowDefinition Height="auto"/>
</Grid.RowDefinitions> <RowDefinition Height="*"/>
</Grid.RowDefinitions>
<VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="0"/> <VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="0"/>
<VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="2"/> <VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="2"/>
<VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="0" Grid.Row="1"/> <VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="0" Grid.Row="1"/>
<VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="2" Grid.Row="1"/> <VerticalStackLayout BackgroundColor="{StaticResource Secondary}" Grid.Column="2" Grid.Row="1"/>
<Grid Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<CollectionView ItemsSource="{Binding GameList}" SelectionMode="Single" SelectionChanged="OnClickGameList" ItemsLayout="VerticalGrid, 3" Grid.Column="1"> <Grid.RowDefinitions>
<CollectionView.ItemTemplate> <RowDefinition Height="auto"/>
<DataTemplate> <RowDefinition Height="auto"/>
<Border MinimumWidthRequest="200" Margin="10, 10, 10, 10"> </Grid.RowDefinitions>
<Grid HeightRequest="950">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Image Source="{Binding Cover}" Aspect="AspectFit" Margin="0,0,0,0" WidthRequest="600" HeightRequest="750"/> <SearchBar Grid.ColumnSpan="2" Placeholder="Rechercher un jeu" Margin="5"/>
<Label FontAttributes="Bold" FontSize="30" Text="{Binding Name}" Grid.Row="1" HorizontalTextAlignment="Center"/> <SearchBar Grid.Column="0" Grid.Row="1" Placeholder="Tag 1" WidthRequest="200" HorizontalOptions="End" Margin="5"/>
<SearchBar Grid.Column="1" Grid.Row="1" Placeholder="Tag 2" WidthRequest="200" HorizontalOptions="Start" Margin="5"/>
</Grid>
<Grid Grid.Row="2"> <CollectionView ItemsSource="{Binding GameList}" SelectionMode="Single" SelectionChanged="OnClickGameList" ItemsLayout="VerticalGrid, 3" Grid.Column="1" Grid.Row="1">
<Grid.ColumnDefinitions> <CollectionView.ItemTemplate>
<ColumnDefinition Width="*"/> <DataTemplate>
<ColumnDefinition Width="auto"/> <Border MinimumWidthRequest="200" Margin="10, 10, 10, 10">
</Grid.ColumnDefinitions> <Grid HeightRequest="950">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="auto"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Text="Tags :"/>
<CollectionView ItemsSource="{Binding Tags}" Grid.Row="1" Grid.ColumnSpan="2"> <Image Source="{Binding Cover}" Aspect="AspectFit" Margin="0,0,0,0" WidthRequest="600" HeightRequest="750"/>
<CollectionView.ItemTemplate> <Label FontAttributes="Bold" FontSize="30" Text="{Binding Name}" Grid.Row="1" HorizontalTextAlignment="Center"/>
<DataTemplate>
<Label Padding="10,0,0,0" Text="{Binding}"/> <Grid Grid.Row="2">
</DataTemplate> <Grid.ColumnDefinitions>
</CollectionView.ItemTemplate> <ColumnDefinition Width="*"/>
</CollectionView> <ColumnDefinition Width="auto"/>
<Label Text="{Binding Year}" Grid.Row="1" Grid.Column="2" HorizontalTextAlignment="End" VerticalTextAlignment="End"/> </Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Text="Tags :"/>
<CollectionView ItemsSource="{Binding Tags}" Grid.Row="1" Grid.ColumnSpan="2">
<CollectionView.ItemTemplate>
<DataTemplate>
<Label Padding="10,0,0,0" Text="{Binding}"/>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<Label Text="{Binding Year}" Grid.Row="1" Grid.Column="2" HorizontalTextAlignment="End" VerticalTextAlignment="End"/>
</Grid>
</Grid> </Grid>
</Grid> </Border>
</Border> </DataTemplate>
</DataTemplate> </CollectionView.ItemTemplate>
</CollectionView.ItemTemplate> </CollectionView>
</CollectionView> </Grid>
</Grid> </ScrollView>
</ScrollView> <ImageButton Source="add_white.png" Background="transparent" WidthRequest="50" HeightRequest="50" HorizontalOptions="End" VerticalOptions="End" Margin="0, 0, 10, 10" Clicked="AddGame"/>
</Grid>
</ContentPage> </ContentPage>

@ -1,6 +1,7 @@
namespace Stim; namespace Stim;
using Model; using Model;
using StimPersistance; using StimPersistance;
using StimStub;
public partial class MainPage : ContentPage public partial class MainPage : ContentPage
{ {
@ -18,9 +19,4 @@ public partial class MainPage : ContentPage
{ {
await Navigation.PushAsync(new DetailledPage((sender as CollectionView).SelectedItem as Game)); await Navigation.PushAsync(new DetailledPage((sender as CollectionView).SelectedItem as Game));
} }
private async void goToMainPage(object sender, EventArgs e)
{
await Navigation.PushAsync(new MainPage());
}
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

@ -14,7 +14,7 @@
</Style> </Style>
<Style TargetType="Border"> <Style TargetType="Border">
<Setter Property="Stroke" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" /> <Setter Property="Stroke" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource Primary}}" />
<Setter Property="StrokeShape" Value="Rectangle"/> <Setter Property="StrokeShape" Value="Rectangle"/>
<Setter Property="StrokeThickness" Value="1"/> <Setter Property="StrokeThickness" Value="1"/>
</Style> </Style>
@ -24,10 +24,10 @@
</Style> </Style>
<Style TargetType="Button"> <Style TargetType="Button">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Primary}}" /> <Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource Primary}}" />
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" /> <Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
<Setter Property="FontFamily" Value="OpenSansRegular"/> <Setter Property="FontFamily" Value="Arial"/>
<Setter Property="FontSize" Value="14"/> <Setter Property="FontSize" Value="15"/>
<Setter Property="CornerRadius" Value="8"/> <Setter Property="CornerRadius" Value="8"/>
<Setter Property="Padding" Value="14,10"/> <Setter Property="Padding" Value="14,10"/>
<Setter Property="VisualStateManager.VisualStateGroups"> <Setter Property="VisualStateManager.VisualStateGroups">
@ -64,8 +64,8 @@
<Style TargetType="DatePicker"> <Style TargetType="DatePicker">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" /> <Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
<Setter Property="BackgroundColor" Value="Transparent" /> <Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="FontFamily" Value="OpenSansRegular"/> <Setter Property="FontFamily" Value="Arial"/>
<Setter Property="FontSize" Value="14"/> <Setter Property="FontSize" Value="15"/>
<Setter Property="VisualStateManager.VisualStateGroups"> <Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList> <VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates"> <VisualStateGroup x:Name="CommonStates">
@ -83,8 +83,8 @@
<Style TargetType="Editor"> <Style TargetType="Editor">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" /> <Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="BackgroundColor" Value="Transparent" /> <Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="FontFamily" Value="OpenSansRegular"/> <Setter Property="FontFamily" Value="Arial"/>
<Setter Property="FontSize" Value="14" /> <Setter Property="FontSize" Value="15" />
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" /> <Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
<Setter Property="VisualStateManager.VisualStateGroups"> <Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList> <VisualStateGroupList>
@ -103,8 +103,8 @@
<Style TargetType="Entry"> <Style TargetType="Entry">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" /> <Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="BackgroundColor" Value="Transparent" /> <Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="FontFamily" Value="OpenSansRegular"/> <Setter Property="FontFamily" Value="Arial"/>
<Setter Property="FontSize" Value="14" /> <Setter Property="FontSize" Value="15" />
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" /> <Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
<Setter Property="VisualStateManager.VisualStateGroups"> <Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList> <VisualStateGroupList>
@ -146,7 +146,7 @@
</Style> </Style>
<Style TargetType="Label"> <Style TargetType="Label">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Primary}}" /> <Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource Primary}}" />
<Setter Property="FontFamily" Value="Arial" /> <Setter Property="FontFamily" Value="Arial" />
<Setter Property="FontSize" Value="15" /> <Setter Property="FontSize" Value="15" />
<Setter Property="Margin" Value="5"/> <Setter Property="Margin" Value="5"/>
@ -174,8 +174,8 @@
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" /> <Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
<Setter Property="TitleColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" /> <Setter Property="TitleColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
<Setter Property="BackgroundColor" Value="Transparent" /> <Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="FontFamily" Value="OpenSansRegular"/> <Setter Property="FontFamily" Value="Arial"/>
<Setter Property="FontSize" Value="14"/> <Setter Property="FontSize" Value="15"/>
<Setter Property="VisualStateManager.VisualStateGroups"> <Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList> <VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates"> <VisualStateGroup x:Name="CommonStates">
@ -210,8 +210,8 @@
<Style TargetType="RadioButton"> <Style TargetType="RadioButton">
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="Transparent"/>
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" /> <Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="FontFamily" Value="OpenSansRegular"/> <Setter Property="FontFamily" Value="Arial"/>
<Setter Property="FontSize" Value="14"/> <Setter Property="FontSize" Value="15"/>
<Setter Property="VisualStateManager.VisualStateGroups"> <Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList> <VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates"> <VisualStateGroup x:Name="CommonStates">
@ -231,12 +231,13 @@
</Style> </Style>
<Style TargetType="SearchBar"> <Style TargetType="SearchBar">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" /> <Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource Primary}}" />
<Setter Property="PlaceholderColor" Value="{StaticResource Gray500}" /> <Setter Property="PlaceholderColor" Value="{StaticResource Primary}" />
<Setter Property="CancelButtonColor" Value="{StaticResource Gray500}" /> <Setter Property="CancelButtonColor" Value="{StaticResource Primary}" />
<Setter Property="BackgroundColor" Value="Transparent" /> <Setter Property="BackgroundColor" Value="{StaticResource Gray500}" />
<Setter Property="FontFamily" Value="OpenSansRegular" /> <Setter Property="FontFamily" Value="Arial" />
<Setter Property="FontSize" Value="14" /> <Setter Property="FontSize" Value="15" />
<Setter Property="FontAutoScalingEnabled" Value="True" />
<Setter Property="VisualStateManager.VisualStateGroups"> <Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList> <VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates"> <VisualStateGroup x:Name="CommonStates">
@ -256,8 +257,8 @@
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" /> <Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
<Setter Property="PlaceholderColor" Value="{StaticResource Gray500}" /> <Setter Property="PlaceholderColor" Value="{StaticResource Gray500}" />
<Setter Property="BackgroundColor" Value="Transparent" /> <Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="FontFamily" Value="OpenSansRegular" /> <Setter Property="FontFamily" Value="Arial" />
<Setter Property="FontSize" Value="14" /> <Setter Property="FontSize" Value="15" />
<Setter Property="VisualStateManager.VisualStateGroups"> <Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList> <VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates"> <VisualStateGroup x:Name="CommonStates">
@ -336,8 +337,8 @@
<Style TargetType="TimePicker"> <Style TargetType="TimePicker">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" /> <Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="Transparent"/>
<Setter Property="FontFamily" Value="OpenSansRegular"/> <Setter Property="FontFamily" Value="Arial"/>
<Setter Property="FontSize" Value="14"/> <Setter Property="FontSize" Value="15"/>
<Setter Property="VisualStateManager.VisualStateGroups"> <Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList> <VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates"> <VisualStateGroup x:Name="CommonStates">

Loading…
Cancel
Save