diff --git a/source/Trek-12/Models/Game/Map.cs b/source/Trek-12/Models/Game/Map.cs index 56dbb69..e1399bb 100644 --- a/source/Trek-12/Models/Game/Map.cs +++ b/source/Trek-12/Models/Game/Map.cs @@ -1,4 +1,6 @@ -namespace Models.Game +using System.Collections.ObjectModel; + +namespace Models.Game { /// @@ -19,7 +21,8 @@ /// /// It is the grid of the possible operation in the game /// - public List OperationGrid { get; private set; } + public ReadOnlyObservableCollection OperationGrid { get; private set; } + ObservableCollection operationGrid = new ObservableCollection(); /// /// 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(operationGrid); + InitializeOperationGrid(operationGrid); RopePaths = new List>(); Zones = new List>(); } @@ -62,9 +66,8 @@ /// Initializes the operation grid of the map. /// /// Return the operation grid - private List InitializeOperationGrid() + private void InitializeOperationGrid(ObservableCollectionoperationGrid) { - var operationGrid = new List(); 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; } } } \ No newline at end of file diff --git a/source/Trek-12/Stub/Stub.cs b/source/Trek-12/Stub/Stub.cs index 5415afd..39a1450 100644 --- a/source/Trek-12/Stub/Stub.cs +++ b/source/Trek-12/Stub/Stub.cs @@ -11,8 +11,8 @@ namespace Stub public Stub() { - ListMap = new ReadOnlyObservableCollection(listmap); LoadMap(); + ListMap = new ReadOnlyObservableCollection(listmap); } public void LoadMap() { diff --git a/source/Trek-12/Trek-12/Views/PageBoard.xaml b/source/Trek-12/Trek-12/Views/PageBoard.xaml index 6b2f4a4..2b791c2 100644 --- a/source/Trek-12/Trek-12/Views/PageBoard.xaml +++ b/source/Trek-12/Trek-12/Views/PageBoard.xaml @@ -5,8 +5,8 @@ Title="Board"> -