Merged
Conversation
…mand in the GamePageViewModel.
christiannagel
approved these changes
Apr 10, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Summary
This pull request includes several significant changes to the game functionality in the
Codebreakerproject. The main focus of these changes is to introduce the ability to cancel a game and handle the associated scenarios.Package Update
The
CNinnovation.Codebreaker.GamesClientpackage inCodebreaker.ViewModels.csprojwas updated from3.6.0-beta.21to3.6.0-beta.24. This update is necessary to keep the project up-to-date with the latest features and improvements of the package.New Class and Method
A new class
GameCancelledMessagewas added toGameCancelledMessage.cs. This class is used to send a message when a game is cancelled.In
GamePageViewModel.cs, a new methodCanCancelGamewas added. This method checks if a game can be cancelled by verifying that the game is not null and not finished. This is a crucial check to prevent any unwanted behavior or errors.Game Cancellation
A new
RelayCommandattribute was added to a new methodCancelGameAsync. This method is responsible for cancelling the game if it is not null. If the game is null, it throws anInvalidOperationException, ensuring that the game exists before attempting to cancel it.The
CancelGameAsyncmethod also handles different scenarios that might occur during the cancellation process. If the game cannot be cancelled due to aBadRequestHTTP status code, it shows an info bar message "Could not cancel the game". If there are networking issues, it shows an info bar message "Networking issues". These messages provide feedback to the user about the status of the cancellation process.After successfully cancelling the game, the method sets the game to null and sends a
GameCancelledMessage. This design decision ensures that the game state is properly reset after cancellation and that other parts of the application are notified about the cancellation.