Skip to content

Commit b354a92

Browse files
Merge pull request #178 from CodebreakerApp/177-nuget-packaged-readme-file
177 nuget packaged readme file
2 parents 10942b4 + c26b100 commit b354a92

5 files changed

Lines changed: 69 additions & 39 deletions

File tree

src/Codebreaker.ViewModels/Components/SelectedFieldViewModel.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
namespace Codebreaker.ViewModels.Models;
22

3+
/// <summary>
4+
/// Represents a field in a move.
5+
/// </summary>
6+
/// <param name="possibleColors">The possible colors for this field.</param>
37
public partial class Field(string[] possibleColors) : ObservableObject
48
{
9+
/// <summary>
10+
/// The selected color for this field.
11+
/// </summary>
512
[ObservableProperty]
613
private string? _color;
714

15+
/// <summary>
16+
/// The possible colors for this field.
17+
/// </summary>
818
public string[] PossibleColors { get; init; } = possibleColors;
919
}

src/Codebreaker.ViewModels/Services/GameInfoService.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/Codebreaker.ViewModels/Services/IDialogService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace Codebreaker.ViewModels.Services;
22

3+
[Obsolete("Use IInfoBarService instead.")]
34
public interface IDialogService
45
{
56
Task ShowMessageAsync(string message);

src/Codebreaker.ViewModels/docs/readme.md

Lines changed: 58 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)