|
1 | | -namespace DevTKSS.Uno.Samples.MvuxGallery.Models.CodeSamples; |
2 | 1 |
|
3 | 2 | public record CodeSampleOptionsConfiguration |
4 | 3 | { |
5 | | - public Dictionary<string, CodeSampleOption> Samples { get; init; } = new(); |
| 4 | + public CodeSampleOption[] Samples { get; init; } = Array.Empty<CodeSampleOption>(); |
6 | 5 | } |
7 | 6 |
|
8 | 7 | public record CodeSampleOption |
9 | 8 | { |
| 9 | + public string SampleID { get; init; } = string.Empty; |
10 | 10 | public string Description { get; init; } = string.Empty; |
11 | 11 | public string FilePath { get; init; } = string.Empty; |
12 | | - public List<(int Start, int End)> LineRanges { get; init; } = []; |
| 12 | + public Lines[] LineRanges { get; init; } = []; |
13 | 13 | } |
14 | | - |
15 | | -namespace DevTKSS.Uno.Samples.MvuxGallery.Models.CodeSamples; |
16 | | - |
17 | | -[JsonSerializable(typeof(CodeSampleOptionsConfiguration))] |
18 | | -public partial class CodeSampleOptionsConfigurationContext : JsonSerializerContext |
| 14 | +public record Lines |
19 | 15 | { |
| 16 | + public int Start { get; init; } |
| 17 | + public int End { get; init; } |
20 | 18 | } |
21 | 19 |
|
| 20 | +[JsonSerializable(typeof(CodeSampleOptionsConfiguration))] |
22 | 21 | [JsonSerializable(typeof(CodeSampleOption))] |
| 22 | +[JsonSerializable(typeof(ListboardSampleOptions))] |
| 23 | +[JsonSerializable(typeof(MainSampleOptions))] |
| 24 | +[JsonSerializable(typeof(CounterSampleOptions))] |
| 25 | +[JsonSerializable(typeof(SimpleCardsSampleOptions))] |
23 | 26 | public partial class CodeSampleOptionContext : JsonSerializerContext |
24 | 27 | { |
25 | 28 | } |
26 | 29 |
|
| 30 | +public record ListboardSampleOptions : CodeSampleOptionsConfiguration |
27 | 31 | { |
28 | | - "ListboardSampleConfiguration": { |
29 | | - "FeedView + ListView XAML": { |
30 | | - "Description": "", |
31 | | - "FilePath": "Assets/Samples/FeedView-ListView-Sample.xaml.txt", |
32 | | - "LineRanges": [] |
33 | | - }, |
34 | | - "Use Service to load Data from Storage": { |
35 | | - "Description": "This sample shows how to use a service to load data from storage. The service is registered in the DI container and can be injected into the view model.", |
36 | | - "FilePath": "Assets/Samples/Listboard-SampleViaService.cs.txt", |
37 | | - "LineRanges": [] |
38 | | - }, |
39 | | - "DI Storage handling Service": { |
40 | | - "FilePath": "Assets/Samples/Listboard-StorageService.cs.txt", |
41 | | - "LineRanges": [] |
42 | | - }, |
43 | | - "Settings DataModel Definition": { |
44 | | - "Description": "While DataModels used to load Data via IOptions can not be fully immutable, using init instead of set allows us to set the properties only once, when the object is created.", |
45 | | - "FilePath": "Assets/Samples/CodeSample-Definition.cs.txt", |
46 | | - "LineRanges": [ 1, 13 ] |
47 | | - }, |
48 | | - "Settings DataModel JsonContext": { |
49 | | - "Description": "Define the JsonSerializerContext to load the code sample options configuration from the appsettings.json file.", |
50 | | - "FilePath": "Assets/Samples/CodeSample-Definition.cs.txt", |
51 | | - "LineRanges": [ 15, 25 ] |
52 | | - }, |
53 | | - "Settings Data in appsettings": { |
54 | | - "Description": "Settings to find storage Data, can easily be stored in appsettings.json, since we can update them via IWritableOptions.", |
55 | | - "FilePath": "Assets/Samples/CodeSample-Definition.cs.txt", |
56 | | - "LineRanges": [] |
57 | | - }, |
58 | | - "XAML DataTemplate": { |
59 | | - "Description": "The DataTemplate is used to define how the data is displayed in the ListView. The DataTemplate is showing a Card Control from Uno.Toolkit.UI and is definied in a ResourcesDictionary loaded via MergedResourcesDictionaries.", |
60 | | - "FilePath": "Assets/Samples/Card-GalleryImage.DataTemplate.xaml.txt", |
61 | | - "LineRanges": [] |
62 | | - }, |
63 | | - }, |
| 32 | +} |
| 33 | + |
| 34 | + "ListboardSampleOptions": { |
| 35 | + "Samples": [ |
| 36 | + { |
| 37 | + "SampleID": "FeedView + ListView XAML", |
| 38 | + "Description": "This sample shows how to use the FeedView control from Uno.Extensions.Reactive.UI. The FeedView usually is beeing used to let you bind to a Feed, ListFeed, State or ListState, which allows to Request a Refresh of the underlieing data. In this sample, we are using a ListView which then actually shows the Data, Binding to the depending Properties of the Records Definition. By default, if you dont explicitly tell the FeedView otherwhise, e.g. by <LoadingTemplate>, the DataTemplate defining the ListView, will be the <ValueTemplate> after fetching the Data.", |
| 39 | + "FilePath": "Assets/Samples/FeedView-ListView-Sample.xaml.txt", |
| 40 | + "LineRanges": [] |
| 41 | + }, |
| 42 | + { |
| 43 | + "SampleID": "Load Data from Storage \n (by Service)", |
| 44 | + "Description": "This sample shows how to use a service to load data from storage. The service is registered in the DI container and can be injected into the view model.", |
| 45 | + "FilePath": "Assets/Samples/Listboard-SampleViaService.cs.txt", |
| 46 | + "LineRanges": [] |
| 47 | + }, |
| 48 | + { |
| 49 | + "SampleID": "DI Storage handling Service", |
| 50 | + "Description": "", |
| 51 | + "FilePath": "Assets/Samples/CodeSampleService.cs.txt", |
| 52 | + "LineRanges": [] |
| 53 | + }, |
| 54 | + { |
| 55 | + "SampleID": "Settings DataModel Definition", |
| 56 | + "Description": "While DataModels used to load Data via IOptions can not be fully immutable, using init instead of set allows us to set the properties only once, when the object is created.", |
| 57 | + "FilePath": "Assets/Samples/CodeSample-Definition.cs.txt", |
| 58 | + "LineRanges": [ |
| 59 | + { |
| 60 | + "Start": 1, |
| 61 | + "End": 13 |
| 62 | + } |
| 63 | + ] |
| 64 | + }, |
| 65 | + { |
| 66 | + "SampleID": "Settings DataModel JsonContext", |
| 67 | + "Description": "Define the JsonSerializerContext to load the code sample options configuration from the appsettings.json file.", |
| 68 | + "FilePath": "Assets/Samples/CodeSample-Definition.cs.txt", |
| 69 | + "LineRanges": [ |
| 70 | + { |
| 71 | + "Start": 15, |
| 72 | + "End": 32 |
| 73 | + } |
| 74 | + ] |
| 75 | + }, |
| 76 | + { |
| 77 | + "SampleID": "Settings Data in appsettings", |
| 78 | + "Description": "Settings to find storage Data, can easily be stored in appsettings.json, since we can update them via IWritableOptions.", |
| 79 | + "FilePath": "Assets/Samples/CodeSample-Definition.cs.txt", |
| 80 | + "LineRanges": [ |
| 81 | + { |
| 82 | + "Start": 34, |
| 83 | + "End": 70 |
| 84 | + } |
| 85 | + ] |
| 86 | + }, |
| 87 | + { |
| 88 | + "SampleID": "XAML DataTemplate", |
| 89 | + "Description": "The DataTemplate is used to define how the data is displayed in the ListView. The DataTemplate is showing a Card Control from Uno.Toolkit.UI and is definied in a ResourcesDictionary loaded via MergedResourcesDictionaries.", |
| 90 | + "FilePath": "Assets/Samples/Card-GalleryImage.DataTemplate.xaml.txt", |
| 91 | + "LineRanges": [] |
| 92 | + }, |
| 93 | + { |
| 94 | + "SampleID": "Get GalleryImages via \n FeedList in Model", |
| 95 | + "Description": "This sample shows how to use a model with properties that are bound to the view. The model is a simple class with properties that are used in the view.", |
| 96 | + "FilePath": "Assets/Samples/ModelBinding-Sample.cs.txt", |
| 97 | + "LineRanges": [] |
| 98 | + } |
| 99 | + ] |
| 100 | + } |
0 commit comments