diff --git a/source/Trek-12/Models/Game/Game.cs b/source/Trek-12/Models/Game/Game.cs index 6d19c41..374152d 100644 --- a/source/Trek-12/Models/Game/Game.cs +++ b/source/Trek-12/Models/Game/Game.cs @@ -23,6 +23,8 @@ namespace Models.Game [DataContract] public class Game : INotifyPropertyChanged { + public bool IsPreviousGameNotFinished { get; private set; } + /* Persistence Interface */ public IPersistence PersistenceManager { get; set; } @@ -134,6 +136,20 @@ namespace Models.Game { Maps.Add(map); } + + /// + /// Deletes the last game in the list of games. Use for avoiding stack not finished games. + /// + /// + public bool DeleteGame() + { + if (Games.Count == 0) + { + return false; + } + Games.RemoveAt(Games.Count - 1); // Remove the last game + return true; + } /// /// Adds a new best score to the list of best scores. Or updates it if it already exists. @@ -248,6 +264,10 @@ namespace Models.Game } foreach (var game in data.Item2) { + if (game.IsRunning) + { + IsPreviousGameNotFinished = true; + } Games.Add(game); } foreach (var map in data.Item3) diff --git a/source/Trek-12/Trek-12/Views/PageSelectMap.xaml b/source/Trek-12/Trek-12/Views/PageSelectMap.xaml index 68580d9..e86bd52 100644 --- a/source/Trek-12/Trek-12/Views/PageSelectMap.xaml +++ b/source/Trek-12/Trek-12/Views/PageSelectMap.xaml @@ -42,6 +42,16 @@ +