test binding, affichage de la gamelist
continuous-integration/drone/push Build is passing Details

Popup_qui_marche_pas
Anthony RICHARD 2 years ago
parent 804b437e44
commit 3af4ba1307

@ -1,12 +1,13 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class Game
public class Game : INotifyPropertyChanged
{
public string Name
{
@ -43,7 +44,7 @@ namespace Model
public string[] Tags
{
get { return tags; }
get => tags;
set
{
if (value == null || value.Length != 3) return;
@ -52,6 +53,8 @@ namespace Model
}
private string[]? tags;
public event PropertyChangedEventHandler? PropertyChanged;
public List<Review> Reviews { get; private init; }
public Game(string name, string description, int year, string[] tags)

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -8,13 +9,15 @@ namespace Model
{
public class Manager
{
public List<Game> Games = new();
public ObservableCollection<Game> Games { get; set; } = new();
private IPersistance _persistance;
public Manager(IPersistance persistance)
{
_persistance = persistance;
Games = _persistance.LoadGame();
Games.Add(new("test", "description", 2010, new string[3] { "1", "2", "3" }));
Games.Add(new("test2", "description", 2010, new string[3] { "1", "2", "3" }));
Games.Add(new("test2", "description", 2010, new string[3] { "1", "2", "3" }));
}
}
}

@ -1,23 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace Model
{
public interface Persistable
{
public void Load()
{
Console.WriteLine("Todo");
//To do
}
public void Save(List<Game> gamesList)
{
Console.WriteLine("Todo");
//To do
}
}
}

@ -14,7 +14,6 @@
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
@ -23,66 +22,52 @@
<VerticalStackLayout BackgroundColor="Black" Grid.Column="0" Grid.Row="1"/>
<VerticalStackLayout BackgroundColor="Black" Grid.Column="2" Grid.Row="1"/>
<Grid Grid.Column="1" Grid.Row="1" Margin="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Border Margin="10,10,10,0" HeightRequest="750">
<Border.GestureRecognizers>
<TapGestureRecognizer Tapped="Button_Clicked"/>
</Border.GestureRecognizers>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Image Source="eldenring.jpg" Aspect="AspectFit" Margin="0,0,0,0"/>
<Label TextColor="White" FontAttributes="Bold" FontSize="30" Margin="5" FontFamily="arial" Text="Elden Ring" Grid.Row="1" HorizontalTextAlignment="Center"/>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ListView ItemsSource="{Binding Games}" Grid.Column="1">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Label TextColor="White" FontSize="15" Margin="5" FontFamily="arial" Text="Tag :" Grid.Row="0"/>
<Label TextColor="White" FontSize="15" Margin="5" FontFamily="arial" Text=" - Game of the year" Grid.Row="1"/>
<Label TextColor="White" FontSize="15" Margin="5" FontFamily="arial" Text=" - RPG" Grid.Row="2"/>
<Label TextColor="White" FontSize="15" Margin="5" FontFamily="arial" Text=" - Souls" Grid.Row="3"/>
<Image Source="eldenring.jpg" Aspect="AspectFit" Margin="0,0,0,0"/>
<Label TextColor="White" FontAttributes="Bold" FontSize="30" Margin="5" FontFamily="arial" Text="{Binding Name}" Grid.Row="1" HorizontalTextAlignment="Center"/>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label TextColor="White" FontSize="15" Margin="5" FontFamily="arial" Text="Tag :" Grid.Row="0"/>
<Label TextColor="White" FontSize="15" Margin="5" FontFamily="arial" Text=" - Game of the year" Grid.Row="1"/>
<Label TextColor="White" FontSize="15" Margin="5" FontFamily="arial" Text=" - RPG" Grid.Row="2"/>
<Label TextColor="White" FontSize="15" Margin="5" FontFamily="arial" Text=" - Souls" Grid.Row="3"/>
</Grid>
<Label TextColor="White" FontSize="15" Margin="5" FontFamily="arial" Text="{Binding Year}" Grid.Column="2" HorizontalTextAlignment="End" VerticalTextAlignment="End"/>
</Grid>
<Label TextColor="White" FontSize="15" Margin="5" FontFamily="arial" Text="{Binding Description}" Grid.Row="3"/>
</Grid>
<Label TextColor="White" FontSize="15" Margin="5" FontFamily="arial" Text="25/02/2022" Grid.Column="2" HorizontalTextAlignment="End" VerticalTextAlignment="End"/>
</Grid>
<Label TextColor="White" FontSize="15" Margin="5" FontFamily="arial" Text="Elden Ring is an action role-playing game played in a third person perspective, with gameplay focusing on combat and exploration. It features elements similar to those found in other games developed by FromSoftware, such as the Dark Souls series, Bloodborne, and Sekiro: Shadows Die Twice." Grid.Row="3"/>
</Grid>
</Border>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</Grid>
</ScrollView>
</ContentPage>

@ -1,10 +1,17 @@
namespace Stim;
using Model;
using StimPersistance;
public partial class MainPage : ContentPage
{
public IPersistance persistance = new Persistance();
public Manager Manager;
public MainPage()
{
InitializeComponent();
Manager = new(persistance);
BindingContext = Manager;
}
private async void Button_Clicked(object sender, EventArgs e)

@ -50,6 +50,11 @@
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Persistance\Persistance.csproj" />
<ProjectReference Include="..\Stim.Model\Model.csproj" />
</ItemGroup>
<ItemGroup>
<MauiXaml Update="DetailledPage.xaml">
<Generator>MSBuild:Compile</Generator>

Loading…
Cancel
Save