Skip to content

Commit 17249a6

Browse files
committed
docs: Add Information to ctor parameters
chore: Update Launch config, adjusting paths
1 parent 72b4c90 commit 17249a6

File tree

6 files changed

+53
-15
lines changed

6 files changed

+53
-15
lines changed

.vscode/launch.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/main/debugger-launchjson.md
55
"version": "0.2.0",
66
"configurations": [
7+
{
8+
"name": "Uno Platform Desktop",
9+
"type": "Uno",
10+
"request": "launch",
11+
// any Uno* task will do, this is simply to satisfy vscode requirement when a launch.json is present
12+
"preLaunchTask": "build-desktop-MvuxGallery"
13+
},
714
{
815
// Use IntelliSense to find out which attributes exist for C# debugging
916
// Use hover for the description of the existing attributes
@@ -13,13 +20,13 @@
1320
"request": "launch",
1421
"preLaunchTask": "build-desktop-MvuxGallery",
1522
// If you have changed target frameworks, make sure to update the program path.
16-
"program": "${workspaceFolder}/DevTKSS.Uno.SampleApps.MvuxGallery/bin/Debug/net9.0-desktop/DevTKSS.Uno.SampleApps.MvuxGallery.dll",
23+
"program": "${workspaceFolder}/src/DevTKSS.Uno.Samples.MvuxGallery/bin/Debug/net9.0-desktop/DevTKSS.Uno.Samples.MvuxGallery.dll",
1724
"args": [],
1825
"launchSettingsProfile": "DevTKSS MvuxGallery (Desktop)",
1926
"env": {
2027
"DOTNET_MODIFIABLE_ASSEMBLIES": "debug"
2128
},
22-
"cwd": "${workspaceFolder}/DevTKSS.Uno.SampleApps.MvuxGallery",
29+
"cwd": "${workspaceFolder}/src/DevTKSS.Uno.Samples.MvuxGallery",
2330
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
2431
"console": "internalConsole",
2532
"stopAtEntry": false
@@ -30,13 +37,13 @@
3037
"request": "launch",
3138
"preLaunchTask": "build-desktop-XamlNavigationApp",
3239
// If you have changed target frameworks, make sure to update the program path.
33-
"program": "${workspaceFolder}/DevTKSS.Uno.XamlNavigationApp/bin/Debug/net9.0-desktop/DevTKSS.Uno.XamlNavigationApp.dll",
40+
"program": "${workspaceFolder}/src/DevTKSS.Uno.XamlNavigationApp/bin/Debug/net9.0-desktop/DevTKSS.Uno.XamlNavigationApp.dll",
3441
"args": [],
3542
"launchSettingsProfile": "DevTKSS.Uno.XamlNavigationApp (Desktop)",
3643
"env": {
3744
"DOTNET_MODIFIABLE_ASSEMBLIES": "debug"
3845
},
39-
"cwd": "${workspaceFolder}/DevTKSS.Uno.XamlNavigationApp",
46+
"cwd": "${workspaceFolder}/src/DevTKSS.Uno.XamlNavigationApp",
4047
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
4148
"console": "internalConsole",
4249
"stopAtEntry": false
@@ -47,13 +54,13 @@
4754
"request": "launch",
4855
"preLaunchTask": "build-desktop-SimpleMemberSelectionApp",
4956
// If you have changed target frameworks, make sure to update the program path.
50-
"program": "${workspaceFolder}/DevTKSS.Uno.SimpleMemberSelectionApp-1/bin/Debug/net9.0-desktop/DevTKSS.Uno.SimpleMemberSelectionApp.dll",
57+
"program": "${workspaceFolder}/src/DevTKSS.Uno.SimpleMemberSelectionApp/bin/Debug/net9.0-desktop/DevTKSS.Uno.SimpleMemberSelectionApp.dll",
5158
"args": [],
5259
"launchSettingsProfile": "DevTKSS.Uno.SimpleMemberSelectionApp (Desktop)",
5360
"env": {
5461
"DOTNET_MODIFIABLE_ASSEMBLIES": "debug"
5562
},
56-
"cwd": "${workspaceFolder}/DevTKSS.Uno.SimpleMemberSelectionApp",
63+
"cwd": "${workspaceFolder}/src/DevTKSS.Uno.SimpleMemberSelectionApp",
5764
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
5865
"console": "internalConsole",
5966
"stopAtEntry": false

.vscode/tasks.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"type": "process",
88
"args": [
99
"build",
10-
"${workspaceFolder}/DevTKSS.Uno.SampleApps.MvuxGallery/DevTKSS.Uno.SampleApps.MvuxGallery.csproj",
10+
"${workspaceFolder}/src/DevTKSS.Uno.Samples.MvuxGallery/DevTKSS.Uno.Samples.MvuxGallery.csproj",
1111
"/property:GenerateFullPaths=true",
1212
"/property:TargetFramework=net9.0-desktop",
1313
"/consoleloggerparameters:NoSummary"
@@ -20,7 +20,7 @@
2020
"type": "process",
2121
"args": [
2222
"publish",
23-
"${workspaceFolder}/DevTKSS.Uno.SampleApps.MvuxGallery/DevTKSS.Uno.SampleApps.MvuxGallery.csproj",
23+
"${workspaceFolder}/src/DevTKSS.Uno.Samples.MvuxGallery/DevTKSS.Uno.Samples.MvuxGallery.csproj",
2424
"/property:GenerateFullPaths=true",
2525
"/property:TargetFramework=net9.0-desktop",
2626
"/consoleloggerparameters:NoSummary"
@@ -33,7 +33,7 @@
3333
"type": "process",
3434
"args": [
3535
"build",
36-
"${workspaceFolder}/DevTKSS.Uno.XamlNavigationApp/DevTKSS.Uno.XamlNavigationApp.csproj",
36+
"${workspaceFolder}/src/DevTKSS.Uno.XamlNavigationApp/DevTKSS.Uno.XamlNavigationApp.csproj",
3737
"/property:GenerateFullPaths=true",
3838
"/property:TargetFramework=net9.0-desktop",
3939
"/consoleloggerparameters:NoSummary"
@@ -46,7 +46,7 @@
4646
"type": "process",
4747
"args": [
4848
"publish",
49-
"${workspaceFolder}/DevTKSS.Uno.XamlNavigationApp/DevTKSS.Uno.XamlNavigationApp.csproj",
49+
"${workspaceFolder}/src/DevTKSS.Uno.XamlNavigationApp/DevTKSS.Uno.XamlNavigationApp.csproj",
5050
"/property:GenerateFullPaths=true",
5151
"/property:TargetFramework=net9.0-desktop",
5252
"/consoleloggerparameters:NoSummary"
@@ -59,7 +59,7 @@
5959
"type": "process",
6060
"args": [
6161
"build",
62-
"${workspaceFolder}/DevTKSS.Uno.SimpleMemberSelectionApp/DevTKSS.Uno.SimpleMemberSelectionApp.csproj",
62+
"${workspaceFolder}/src/DevTKSS.Uno.SimpleMemberSelectionApp/DevTKSS.Uno.SimpleMemberSelectionApp.csproj",
6363
"/property:GenerateFullPaths=true",
6464
"/property:TargetFramework=net9.0-desktop",
6565
"/consoleloggerparameters:NoSummary"
@@ -72,7 +72,7 @@
7272
"type": "process",
7373
"args": [
7474
"publish",
75-
"${workspaceFolder}/DevTKSS.Uno.SimpleMemberSelectionApp/DevTKSS.Uno.SimpleMemberSelectionApp.csproj",
75+
"${workspaceFolder}/src/DevTKSS.Uno.SimpleMemberSelectionApp/DevTKSS.Uno.SimpleMemberSelectionApp.csproj",
7676
"/property:GenerateFullPaths=true",
7777
"/property:TargetFramework=net9.0-desktop",
7878
"/consoleloggerparameters:NoSummary"

docs/articles/de/HowTo-Adding-New-VM-Class-Record-de.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ Um ein für Mvux passendes Model zu erstellen:
3636

3737
![Umbenennen-Klasse-zu-Mvux-Model](../.attachments/renaming-class-to-record-mvux.png)
3838

39+
> [!NOTE]
40+
> In Mvux werden Models als `record`-Typen definiert, um Unveränderlichkeit und wertbasierte Gleichheit zu nutzen, was für die Zustandsverwaltung in Anwendungen vorteilhaft ist.
41+
> Die Verwendung von `partial` ist in Mvux Models unerlässlich, um die vom Framework bereitgestellten Code-Generierungsfunktionen zu ermöglichen, wie z.B. automatische Eigenschaftsänderungsbenachrichtigungen und andere Reduzierungen von Boilerplate-Code.
42+
> [!CAUTION]
43+
> Genau wie bei regulären C#-Klassen können auch Mvux Models oder Services primäre Konstruktoren haben, die standardmäßig die Parameter als Eigenschaften des Record-Typs erzeugen.
44+
> Ein potenzieller Nachteil dabei ist, dass ein `INavigator`-Parameter im primären Konstruktor ebenfalls eine Eigenschaft des Models wäre, was normalerweise nicht das ist, was wir als Teil der öffentlichen API unseres Models wollen.
45+
> Du solltest bevorzugen, diese Service-definierenden Parameter in einem sekundären Konstruktor zu definieren und sie als `private readonly` Felder zu behalten.
46+
3947
### [Ein ViewModel erstellen](#tab/create-mvvm-viewmodel)
4048

4149
Um ein für Mvvm passendes ViewModel zu erstellen:
@@ -47,3 +55,6 @@ Um ein für Mvvm passendes ViewModel zu erstellen:
4755
![Konvertieren-Klasse-zu-ViewModel-Mvvm](../.attachments/converting-class-to-vm-mvvm.png)
4856

4957
---
58+
59+
> [!NOTE]
60+
> Du kannst in Uno ViewModels oder Models frei den primären Konstruktor verwenden, beachte jedoch, dass bei Verwendung von `Uno.Extensions.Navigation` keine Parameter im *Page*-Konstruktor erlaubt sind.

docs/articles/de/Navigation/HowTo-UpgradeExistingApp-de.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ In der Projektdatei, zu erkennen an der Endung `.csproj`, brauchst du dafür neb
3636

3737
> [!TIP]
3838
> Das `Toolkit` Feature wird nur benötigt, wenn Navigations-Steuerelemente wie `TabBar` oder `DrawerControl` verwendet werden sollen.
39+
> [!NOTE]
40+
> Wir benötigen grundsätzlich das `Hosting` Feature und die `DependencyInjection` Funktionalität in unserer Anwendung zu verwenden.
41+
> Ich sage hier absichtlich "grundsätzlich", da ich bspw. in der hier enthaltenen `MvuxGallery` und `SimpleMemberSelectionApp` Anwendungen das `Hosting` Feature entfernt habe, die App erstellt habe und entgegen der offiziellen Dokumentation ich keine Probleme feststellen konnte.
42+
> Alle DI Parameter wurden korrekt aufgelöst und ich war weiterhin im stande `ConfigureServices` für die Registrierung von bspw. `KeyedService` in der zugehörigen `App.xaml.cs` Datei mit dem [![Uno.Sdk 6.3.28](https://img.shields.io/badge/Uno.Sdk-6.3.28-blue)](https://www.nuget.org/packages/Uno.Sdk/6.3.28) zu verwenden.
3943
4044
## App.xaml.cs Konfiguration
4145

docs/articles/en/HowTo-Adding-New-VM-Class-Record-en.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ uid: DevTKSS.Uno.Setup.HowTo-AddingNew-VM-Class-Record.en
44

55
## How To: Create a ViewModel or Model from Classes
66

7-
In this guide, we will look at how to create a new class element in Visual Studio and then create either a ViewModel or a Model for use in an Uno Platform application with **MVUX**.
7+
In this guide, we will look at how to create a new class element in Visual Studio and then create either a ViewModel or a Model for use in an Uno Platform application.
88

99
For the following steps, let's assume the page that the element to be created belongs to is called **SamplePage.xaml**
1010

@@ -16,9 +16,10 @@ For the following steps, let's assume the page that the element to be created be
1616
![Adding-new-Item-to-sln](../.attachments/Adding-new-Item-to-sln-en.png)
1717

1818
2. **Create a Class element:**
19-
1. Select the **`Class`** element in the list and name it according to the following scheme:
19+
1. Select the **`Class`** element in the list and name it according to the naming conventions:
20+
21+
Your application uses:
2022

21-
**Your application uses:**
2223
- **Mvvm:** `SampleViewModel.cs`
2324
- **Mvux:** `SampleModel.cs`
2425

@@ -36,6 +37,14 @@ To create a Model suitable for Mvux:
3637

3738
![Renaming-Class-to-Mvux-Model](../.attachments/renaming-class-to-record-mvux.png)
3839

40+
> [!NOTE]
41+
> In Mvux, Models are defined as `record` types to leverage immutability and value-based equality, which are beneficial for state management in applications.
42+
> Using `partial` is essential in Mvux Models to enable code generation features provided by the framework, such as automatic property change notifications and other boilerplate code reductions.
43+
> [!CAUTION]
44+
> Just like in regular C# classes, Mvux Models or Services can also have primary constructors, which will by default produce the parameters as properties of the record type.
45+
> A potential downside of this is, that a `INavigator` parameter in the primary constructor would also be a property of the Model, which is not what we normally want as part of our Model's public API.
46+
> You should prefer defining those Service defining parameters in a secondary constructor and keep them as `private readonly` fields.
47+
3948
### [Create a ViewModel](#tab/create-mvvm-viewmodel)
4049

4150
To create a ViewModel suitable for Mvvm:
@@ -47,3 +56,6 @@ To create a ViewModel suitable for Mvvm:
4756
![Converting-Class-to-ViewModel-Mvvm](../.attachments/converting-class-to-vm-mvvm.png)
4857

4958
---
59+
60+
> [!NOTE]
61+
> You are free to use the primary constructor in Uno ViewModels or Models, but note that using `Uno.Extensions.Navigation` you can not have parameters in the *page* constructor.

docs/articles/en/Navigation/HowTo-UpgradeExistingApp-en.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ In the project file, recognizable by the `.csproj` extension, you need the follo
3636

3737
> [!TIP]
3838
> The `Toolkit` feature is only required to use navigation controls like `TabBar` or `DrawerControl`.
39+
> [!NOTE]
40+
> In general we need the `Hosting` feature to use `DependencyInjection` in our app.
41+
> I say "in general" because, for example, in the included `MvuxGallery` and `SimpleMemberSelectionApp` I removed the `Hosting` feature, created the app, and contrary to the official documentation I couldn't find any problems.
42+
> All DI parameters were resolved correctly and I was still able to use `ConfigureServices` with `KeyedService` Registration in the corresponding `App.xaml.cs` file with the [![Uno.Sdk 6.3.28](https://img.shields.io/badge/Uno.Sdk-6.3.28-blue)](https://www.nuget.org/packages/Uno.Sdk/6.3.28).
3943
4044
## App.xaml.cs Configuration
4145

0 commit comments

Comments
 (0)