🚧 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>
@ -19,7 +21,8 @@
/// <summary>
/// It is the grid of the possible operation in the game
/// </summary>
public List<OperationCell> OperationGrid { get; private set; }
public ReadOnlyObservableCollection<OperationCell> OperationGrid { get; private set; }
ObservableCollection<OperationCell> operationGrid = new ObservableCollection<OperationCell>();
/// <summary>
/// It is a list of a list containing user's rope paths in the current game
@ -39,7 +42,8 @@
{
Boards = InitializeBoards();
Background = background;
OperationGrid = InitializeOperationGrid();
OperationGrid = new ReadOnlyObservableCollection<OperationCell>(operationGrid);
InitializeOperationGrid(operationGrid);
RopePaths = new List<List<Cell>>();
Zones = new List<List<Cell>>();
}
@ -62,9 +66,8 @@
/// Initializes the operation grid of the map.
/// </summary>
/// <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 j = 0; j < 4; j++) // 4 cells per operation
@ -72,7 +75,6 @@
operationGrid.Add(new OperationCell(i, j));
}
}
return operationGrid;
}
}
}

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

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

Loading…
Cancel
Save