@@ -8,32 +8,71 @@ See https://github.com/codebreakerapp for more information on the complete solut
88
99## The ViewModels
1010
11- | Class | Description |
12- | -------| -------------|
13- | GamePageViewModel | The GamePageViewModel is the view-model type for the game page with commands to start games, set moves. |
14- | GameViewModel | The GameViewModel is the view-model type for game information. |
15- | MoveViewModel | The MoveViewModel is the view-model type for a game move. |
16- | InfoMessageViewModel | Alternative option of IDialogService |
11+ ### GamePageViewModel
12+ The _ GamePageViewModel_ is the view-model type for the game page with commands to start games, set moves.
13+ The _ GamePageViewModel_ is the main view-model type to communicate with the application.
1714
18- The ` GamePageViewModel ` is the main view-model type to communicate with the application.
15+ | Members | Description |
16+ | ------------| --------------------|
17+ | ctor | Needs ` IGamesClient ` (communication with the games-service API), ` IInfoBarService ` |
18+ | Game | The current game |
19+ | IsLoading | Indicates processing activitiy, where showing a loading indicator is appropriate |
20+ | SelectedFields | The fields used for selecting the colors for the next move |
21+ | Username | The username of the player. This name is used when starting the game |
22+ | StartGameCommand | Command to start a new game |
23+ | MakeMoveCommand | Command to set a move |
24+
25+ ## Model types
26+
27+ The following model types are used to contain information about the game.
28+
29+ ### Game
30+
31+ | Members | Description |
32+ | ------------| --------------------|
33+ | Id | The ID of the game |
34+ | GameType | The type of the game |
35+ | PlayerName | The name of the player |
36+ | StartTime | The start time of the game |
37+ | EndTime | The end time of the game |
38+ | Duration | The duration of the game |
39+ | NumberCodes | The number of codes in the game |
40+ | MaxMoves | The maximum number of moves allowed |
41+ | IsFinished | Indicates if the game is finished |
42+ | IsVictory | Indicates if the game is a victory |
43+ | FieldValues | The values of the fields |
44+ | Moves | The moves made in the game |
45+
46+ ### Move
1947
2048| Members | Description |
2149| ------------| --------------------|
22- | ctor | Needs ` IGamesClient ` (communication with the games-service API), ` IOptions<GamePageViewModelOptions> ` , ` IDialogService ` |
50+ | GuessPegs | The guess pegs from the user for this move |
51+ | KeyPegs | The result from the analyer for this move based on the associated game that contains the move. (Null if the move was not analyzed yet.) |
2352
24- ### Supporting types
53+ ### Field
2554
26- | Class | Description |
27- | -------| -------------|
28- | GameMode | An enumeration - is the game not running, started, are moves set, lost, won? |
55+ | Members | Description |
56+ | ------------| --------------------|
57+ | PossibleColors | The possible colors for the field |
58+ | Color | The selected color for the field |
2959
30- In the constructor, inject the ` HttpClient ` class. You can use ` Microsoft.Extensions.Http ` to configure the ` HttpClient ` class.
3160
32- ## Model types
61+ ## Services
62+ ### IInfoBarService / InfoBarService
63+ Service to show messages in the info bar.
64+ The UI is able to bind to the ` Messages ` -ObservableCollection for displaying the mssages.
65+
66+ ``` C#
67+ // Register the service in the platform-specific project
68+ services .AddScoped <IInfoBarService , InfoBarService >();
69+ ```
3370
34- The following model types are used to return information about the game.
71+ ### INavigationService
72+ Interface for the service to navigate between pages.
73+ The implementation for this interface needs to be made by the platform-specific project.
3574
36- | Model type | Description |
37- | ------------ | ------------- |
38- | Game | Contains the game id, the game status, the game moves and the game result |
39- | Move | Contains the move number, the guess ( ` GuessPegs ` ) and the result of the guess ( ` KeyPegs ` ) |
75+ ``` C#
76+ // Register the service in the platform-specific project
77+ services . AddScoped < INavigationService , MyPlatformSpecificNavigationServiceImplementation >();
78+ ```
0 commit comments