Skip to content

Commit 53b2692

Browse files
committed
Fixed bug, where infobar messages were not shown on game page
1 parent 121e38f commit 53b2692

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

src/Codebreaker.ViewModels/Pages/GamePageViewModel.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ IInfoBarService infoBarService
5252
};
5353
}
5454

55-
/// <summary>
56-
/// Information on the game - messages, errors, etc. See <see cref="InfoBarMessageService"/>.
57-
/// </summary>
58-
public InfoBarService InfoBarMessageService { get; } = new();
59-
6055
private Game? _game;
6156
/// <summary>
6257
/// <see cref="Models.Game"/> instance."/>
@@ -121,7 +116,7 @@ public Game? Game
121116
/// Updates the <see cref="GameStatus"/> property.
122117
/// Initializes <see cref="Game"/>).
123118
/// Increments the move number.
124-
/// Shows <see cref="IDialogService"/> messages or <see cref="InfoBarMessageService"/> messages with errors.
119+
/// Shows <see cref="IDialogService"/> messages or <see cref="_infoBarService"/> messages with errors.
125120
/// </summary>
126121
/// <returns>A task</returns>
127122
[RelayCommand(AllowConcurrentExecutions = false, FlowExceptionsToTaskScheduler = true)]
@@ -219,17 +214,17 @@ private async Task SetMoveAsync()
219214
if (isVictory)
220215
{
221216
GameStatus = GameMode.Won;
222-
InfoBarMessageService.New.IsSuccessMessage().WithMessage("Congratulations - you won!").Show();
217+
_infoBarService.New.IsSuccessMessage().WithMessage("Congratulations - you won!").Show();
223218
}
224219
else if (ended)
225220
{
226221
GameStatus = GameMode.Lost;
227-
InfoBarMessageService.New.WithMessage("Sorry, you didn't find the matching colors!").Show();
222+
_infoBarService.New.WithMessage("Sorry, you didn't find the matching colors!").Show();
228223
}
229224
}
230225
catch (Exception ex)
231226
{
232-
InfoBarMessageService.New.WithMessage(ex.Message).IsErrorMessage().Show();
227+
_infoBarService.New.WithMessage(ex.Message).IsErrorMessage().Show();
233228
}
234229
finally
235230
{
@@ -254,7 +249,7 @@ private void InitializeValues()
254249
ClearSelectedColor();
255250
GameMoves.Clear();
256251
GameStatus = GameMode.NotRunning;
257-
InfoBarMessageService.Clear();
252+
_infoBarService.Clear();
258253
_moveNumber = 0;
259254
}
260255
}

0 commit comments

Comments
 (0)