🚧 Binding de la table d'operation
continuous-integration/drone/push Build is failing Details

pull/96/head
Lucas DUFLOT 11 months ago
parent b4f27e8b0b
commit ae56f47b33

@ -1,4 +1,6 @@
namespace Models.Game using System.Collections.ObjectModel;
namespace Models.Game
{ {
/// <summary> /// <summary>
@ -19,7 +21,8 @@
/// <summary> /// <summary>
/// It is the grid of the possible operation in the game /// It is the grid of the possible operation in the game
/// </summary> /// </summary>
public List<OperationCell> OperationGrid { get; private set; } public ReadOnlyObservableCollection<OperationCell> OperationGrid { get; private set; }
ObservableCollection<OperationCell> operationGrid = new ObservableCollection<OperationCell>();
/// <summary> /// <summary>
/// It is a list of a list containing user's rope paths in the current game /// It is a list of a list containing user's rope paths in the current game
@ -39,7 +42,8 @@
{ {
Boards = InitializeBoards(); Boards = InitializeBoards();
Background = background; Background = background;
OperationGrid = InitializeOperationGrid(); OperationGrid = new ReadOnlyObservableCollection<OperationCell>(operationGrid);
InitializeOperationGrid(operationGrid);
RopePaths = new List<List<Cell>>(); RopePaths = new List<List<Cell>>();
Zones = new List<List<Cell>>(); Zones = new List<List<Cell>>();
} }
@ -62,9 +66,8 @@
/// Initializes the operation grid of the map. /// Initializes the operation grid of the map.
/// </summary> /// </summary>
/// <returns>Return the operation grid</returns> /// <returns>Return the operation grid</returns>
private List<OperationCell> InitializeOperationGrid() private void InitializeOperationGrid(ObservableCollection<OperationCell>operationGrid)
{ {
var operationGrid = new List<OperationCell>();
for (int i = 0; i < 5; i++) // 5 operations for (int i = 0; i < 5; i++) // 5 operations
{ {
for (int j = 0; j < 4; j++) // 4 cells per operation for (int j = 0; j < 4; j++) // 4 cells per operation
@ -72,7 +75,6 @@
operationGrid.Add(new OperationCell(i, j)); operationGrid.Add(new OperationCell(i, j));
} }
} }
return operationGrid;
} }
} }
} }

@ -11,8 +11,8 @@ namespace Stub
public Stub() public Stub()
{ {
ListMap = new ReadOnlyObservableCollection<Map>(listmap);
LoadMap(); LoadMap();
ListMap = new ReadOnlyObservableCollection<Map>(listmap);
} }
public void LoadMap() { public void LoadMap() {

@ -5,8 +5,8 @@
Title="Board"> Title="Board">
<Grid RowDefinitions="*,auto"> <Grid RowDefinitions="*,auto">
<Grid ColumnDefinitions="*,auto"> <Grid ColumnDefinitions="*,auto">
<CollectionView ItemsSource="{Binding ListMap.OperationGrid}" <CollectionView ItemsSource="{Binding ListMap[0].OperationGrid}"
ItemsLayout="HorizontalGrid,4" ItemsLayout="HorizontalGrid,5"
Grid.Column="1"> Grid.Column="1">
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate> <DataTemplate>

Loading…
Cancel
Save