Skip to content

ViewModel refactoring and simplification#174

Merged
christiannagel merged 16 commits intomainfrom
57-viewmodels
Mar 20, 2024
Merged

ViewModel refactoring and simplification#174
christiannagel merged 16 commits intomainfrom
57-viewmodels

Conversation

@szv
Copy link
Collaborator

@szv szv commented Mar 19, 2024

Pull Request Summary

This pull request includes significant changes to the game logic and structure, with a focus on refactoring and simplifying the codebase. The changes are primarily in the GamePageViewModel, Game, and Move classes.

Major Changes

  1. Package Update: The Microsoft.Extensions.Options package was updated from 7.0.1 to 8.0.2.

  2. Class Removals: Several classes were removed, including GameViewModel, MoveViewModel, GamePageViewModelOptions, GameMode, GameMoveValue, SelectionAndKeyPegs, GameStateChangedMessage, and GameMoveMessage.

  3. Class Additions: New classes were added, including GameEndedMessage, GameStartedMessage, MakeMoveMessage, Field, Game, and Move.

  4. Refactoring of GamePageViewModel: This class was refactored to remove dependencies on IDialogService and IOptions<GamePageViewModelOptions>, and to add dependencies on IGamesClient and IInfoBarService. The StartGameAsync and SetMoveAsync methods were also refactored.

  5. Refactoring of Game and Move classes: The Game class was refactored to change the GameId property to Id, to add the IsFinished property, and to change the FieldValues and Moves properties from ICollection to ObservableCollection. The Move class was refactored to remove the MoveId and MoveNumber properties, and to change the GuessPegs and KeyPegs properties from ObservableCollection to ICollection.

Design Decisions

The refactoring of the GamePageViewModel, Game, and Move classes was done to simplify the codebase and improve maintainability. The removal of certain classes and properties, and the addition of others, was done to streamline the game logic and make it more intuitive. The change in dependencies for GamePageViewModel was made to improve the class's testability and decouple it from specific services. The changes in property types from ICollection to ObservableCollection (and vice versa) were made to better reflect the nature of the data being handled.

@szv szv linked an issue Mar 19, 2024 that may be closed by this pull request
@szv szv requested a review from christiannagel March 19, 2024 12:25
Copy link
Contributor

@christiannagel christiannagel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

breaking changes for the clients.
Change the version in https://github.com/CodebreakerApp/Codebreaker.Xaml/blob/main/src/Directory.Build.props
to 3.7 before we build this
VersionPrefix>3.7.0</VersionPrefix>

@szv szv requested a review from christiannagel March 19, 2024 14:47
Updated the `VersionPrefix` in the `PropertyGroup` of the `Directory.Build.props` file from `3.6.0` to `3.7.0`.
@christiannagel christiannagel merged commit 2244380 into main Mar 20, 2024
@christiannagel christiannagel deleted the 57-viewmodels branch March 20, 2024 08:29
@christiannagel christiannagel restored the 57-viewmodels branch March 20, 2024 08:30
@christiannagel
Copy link
Contributor

christiannagel commented Mar 20, 2024

unit tests don't run successfully! @szv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ViewModels

2 participants