Skip to content

Commit d8d02d2

Browse files
committed
refactor(GalleryImages): Refactor to nested folder
chore: Update Readme content
1 parent 0a708da commit d8d02d2

File tree

11 files changed

+112
-65
lines changed

11 files changed

+112
-65
lines changed

DevTKSS.Uno.Samples.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1010
Directory.Build.targets = Directory.Build.targets
1111
Directory.Packages.props = Directory.Packages.props
1212
global.json = global.json
13+
README.md = README.md
1314
EndProjectSection
1415
EndProject
1516
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevTKSS.Uno.Samples.MvuxGallery", "src\DevTKSS.Uno.Samples.MvuxGallery\DevTKSS.Uno.Samples.MvuxGallery.csproj", "{794614E6-4D93-EC96-D234-DEA56A8F58F9}"

README.md

Lines changed: 78 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
1-
# Mvux meets HotDesign(TM) Sample App
1+
# DevTKSS Uno Samples
22

3-
Example project which should show how different mvux ui controls and model binding can be done
3+
Example projects to see how different things can be done in a Uno Platform App.
44

5-
## Current state
5+
## Table of Contents
6+
1. [DevTKSS Uno Samples](#devtkss-uno-samples)
7+
2. [Mvux Gallery](#mvux-gallery)
8+
- [Controls to be explored in this App](#controls-to-be-explored-in-this-app)
9+
- [Uno.Extensions to be explored here](#unoextensions-to-be-explored-here)
10+
3. [First Recording of Making-Of](#first-recording-of-making-of)
11+
4. [Current state](#current-state)
12+
5. [Help Welcome!](#help-welcome)
13+
6. [See also](#see-also)
614

7-
- [x] Created a [first `working` state](https://github.com/DevTKSS/UnoHotDesignApp1/commit/9f6479fa37901a0478bbc9e1c3e92221223ce4d0)
15+
## Mvux Gallery
816

9-
Not acceptable for me as final result since it had very poor performance and not relyable functionality
17+
At the [Mvux Gallery](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery) you can find:
1018

11-
- [x] Restructuring, Refactoring applying SOC
12-
- [x] Implement SampleCode Presenting like Gallery to have the src code side by side in the running app
13-
- [x] [Working State of DashboardPage](https://github.com/DevTKSS/UnoHotDesignApp1/commit/98fa25af8f23bb27c2dccac39d9248f3fc7254dd)
14-
- [ ] (Re)record the video to show a final step by step Guide to Beginners like me and simplify the start with uno.extensions with Mvux.
15-
16-
## Controls to be explored in this App
19+
### Controls to be explored in this App
1720

1821
- FeedView + GridView
1922
- FeedView + ListView
2023
- DataTemplate centralized Recource definition
2124
- Card
2225
- `ItemOverlayTemplate` DataTemplate layout replicated from WinUI 3 Gallery
2326

24-
## Uno.Extensions to be explored here
27+
### Uno.Extensions to be explored here
2528

2629
- Mvux
2730
- Feed
@@ -34,66 +37,94 @@ Example project which should show how different mvux ui controls and model bindi
3437
- Navigation
3538
- via Xaml
3639
- NavigationView
37-
- MainPage.xaml
40+
- [MainPage.xaml](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/Presentation/Views/MainPage.xaml#L1-L50))
3841
- Via Model
3942
- (planned)
4043

41-
- Hosting
42-
- App.xaml.cs
44+
- Hosting
45+
- [App.xaml.cs](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/App.xaml.cs#L21-L91)
4346

4447
- DependencyInjection
4548
- Service Registration
46-
- App.xaml.cs
49+
- [App.xaml.cs](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/App.xaml.cs#L69-L74)
4750
- Service Definition
48-
- CodeSampleService.cs
49-
- (ICodeSampleService.cs) => to be extracted and added
51+
- [CodeSampleService.cs](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/Models/CodeSamples/CodeSampleService.cs)
52+
- [ICodeSampleService.cs](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/Models/CodeSamples/ICodeSampleService.cs)
5053
- Data Model Definition
51-
- SampleCode.cs#SampleCode
52-
- CodeSampleOptions.cs
53-
- CodeSampleOptionsConfiguration.cs
54+
- [SampleCode.cs](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/Models/CodeSamples/SampleCode.cs)
55+
- [CodeSampleOption.cs](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/Models/CodeSamples/CodeSampleOption.cs)
56+
- [CodeSampleOptionsConfiguration.cs](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/Models/CodeSamples/CodeSampleOptionsConfiguration.cs)
5457

5558
- Serialization
5659
- JsonSerializerContext of each DataModel
57-
- [SampleCodeContext](SampleCode.cs#SampleCodeContext)
58-
- [CodeSampleOptionsContext](CodeSampleOptions.cs#SampleCodeContext)
59-
- [CodeSampleOptionsConfigurationContext] (CodeSampleOptionsConfiguration.cs#CodeSampleOptionsConfigurationContext)
60+
- [SampleCodeContext](SampleCode.cs#L8-L11)
61+
- [CodeSampleOptionsContext](CodeSampleOptions.cs#L8-L11)
62+
- [CodeSampleOptionsConfigurationContext](CodeSampleOptionsConfiguration.cs#L6-L9)
6063

6164
- Configuration
62-
- Data for Serialization
63-
- appsettings.json
65+
- Data for Serialization
66+
- [appsettings.json](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/appsettings.json)
6467

6568
- Storage
6669
- Via Model
67-
- DashboardModel.cs
70+
- [DashboardModel.cs](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/Presentation/ViewModels/DashboardModel.cs#L55-L141)
6871
- Via Service
69-
- CodeSampleService.cs
72+
- [CodeSampleService.cs](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/Models/CodeSamples/CodeSampleService.cs)
7073
- Via StorageExtension
7174
- Currently in private preview package
7275
- Via Uno.Extensions.Storage.IStorage Interface extension
73-
- added as PR to Uno.Extensions
76+
- added as PR to Uno.Extensions [#2734](https://github.com/unoplatform/uno.extensions/pull/2734)
7477

7578
- Localization
7679
- **IStringLocalizer**
7780
- Resources Dictionarys
78-
- en/.resw
79-
- de/.resw
80-
- Binding current value in`IState<string>` and to corresponding View
81-
- DashboardModel.cs
82-
- ListboardModel.cs
83-
- MainModel.cs
84-
- CounterModel.cs
85-
- Requesting localized Items via FeedView
86-
- Service Definition
87-
- GalleryImageService.cs
88-
- Data Model Definition
89-
- GalleryImageModel.cs
81+
- [en](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/Strings/en/Resources.resw)
82+
- [de](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/Strings/en/Resources.resw)
83+
- Binding current value in `IState<string>` and to corresponding View
84+
- [DashboardModel.cs](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/Presentation/ViewModels/DashboardModel.cs#L31)
85+
- [ListboardModel.cs](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/Presentation/ViewModels/ListboardModel.cs#L33)
86+
- [MainModel.cs](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/Presentation/ViewModels/MainModel.cs#L21)
87+
- CounterModel.cs
88+
- Requesting localized Items via FeedView
89+
- Service Definition
90+
- [GalleryImageService.cs](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/Models/GalleryImages/GalleryImageService.cs#L34-L66)
91+
- [IGalleryImageService.cs](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/Models/GalleryImages/IGalleryImageService.cs#L6)
92+
- Data Model Definition
93+
- [GalleryImageModel.cs](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/Models/GalleryImages/GalleryImageModel.cs)
9094
- **ILocalizationService**
91-
- Requesing current culture
92-
- GalleryImageModel.cs
93-
- Switching culture
94-
- (planned)
95+
- Requesing current culture
96+
- [GalleryImageService.cs](./src/DevTKSS.Uno.Samples/DevTKSS.Uno.Samples.MvuxGallery/Models/GalleryImages/GalleryImageService.cs#L19-L30)
97+
- Switching culture
98+
- (planned)
99+
100+
### Fist Recording of Making-Of
101+
102+
> [!NOTE]
103+
> uncut, without sound, will be edited and re-recorded in the future, src at [this commit](https://github.com/DevTKSS/DevTKSS.MvuxSampleApps/commit/8d13dcee8107324e747d828700cfd8fcf780ca37)
104+
>
105+
> This is showing the initial making of from this project at the first commits
106+
107+
<iframe src="https://technischekonstruktion.sharepoint.com/_layouts/15/embed.aspx?UniqueId=8e4c435c-50fd-4d69-82ef-a9f5bc571dd7&embed=%7B%22ust%22%3Atrue%2C%22hv%22%3A%22CopyEmbedCode%22%7D&referrer=StreamWebApp&referrerScenario=EmbedDialog.Create" width="640" height="360" frameborder="0" scrolling="no" allowfullscreen title="Uno HotDesign App Making-Off.mp4"></iframe>
108+
109+
### Current state
110+
111+
- [x] Created a [first `working` state](https://github.com/DevTKSS/UnoHotDesignApp1/commit/9f6479fa37901a0478bbc9e1c3e92221223ce4d0)
112+
- [x] Restructuring, Refactoring applying SOC
113+
- [x] Implement SampleCode Presenting like Gallery to have the src code side by side in the running app
114+
- [x] [Working State of DashboardPage](https://github.com/DevTKSS/UnoHotDesignApp1/commit/98fa25af8f23bb27c2dccac39d9248f3fc7254dd)
115+
- [ ] Fixing ThemeResource Styled that are not seeming to listen to Theme changes
116+
- [ ] Updating the Code Samples in Assets
117+
- [ ] (Re)record the video to show a final step by step Guide to Beginners like me and simplify the start with uno.extensions with Mvux.
118+
119+
## Help Welcome!
120+
121+
If you want to help out, please feel free to open an issue or PR.
95122

96-
## Fist Recording (uncut, without sound)
123+
Every helping hand is welcom and I will try to merge it as soon as possible.
97124

98-
[This Video](https://technischekonstruktion-my.sharepoint.com/:v:/g/personal/info_technische-konstruktion_com/EQyOpS6sImZJmLd83Nn_q6IBb1dfIqudJHjEMebV5PCYqA?e=0EIBcw) is showing the initial making of from this project at the first commits
125+
## See also
99126

127+
- [Uno Platform](https://platform.uno/)
128+
- [Documentation Intro](https://platform.uno/docs/articles/intro.html)
129+
- [Mvux Documentation](https://platform.uno/docs/articles/external/uno.extensions/doc/Learn/Mvux/Overview.html)
130+
- [FeedView Control](https://platform.uno/docs/articles/external/uno.extensions/doc/Learn/Mvux/FeedView.html)

src/DevTKSS.Uno.Samples.MvuxGallery/App.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Text.Json;
2+
using DevTKSS.Uno.Samples.MvuxGallery.Models.GalleryImages;
23
using Uno.Resizetizer;
34

45
namespace DevTKSS.Uno.Samples.MvuxGallery;
@@ -71,7 +72,7 @@ protected async override void OnLaunched(LaunchActivatedEventArgs args)
7172
// TODO: Register your services
7273

7374
.AddSingleton<IGalleryImageService, GalleryImageService>()
74-
.AddSingleton<CodeSampleService>()
75+
.AddSingleton<ICodeSampleService, CodeSampleService>()
7576
.AddJsonTypeInfo(SampleCodeContext.Default.SampleCode)
7677
.AddJsonTypeInfo(CodeSampleOptionContext.Default.CodeSampleOption)
7778
.AddJsonTypeInfo(CodeSampleOptionsConfigurationContext.Default.CodeSampleOptionsConfiguration)

src/DevTKSS.Uno.Samples.MvuxGallery/DevTKSS.Uno.Samples.MvuxGallery.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
</PropertyGroup>
5050
<ItemGroup>
5151
<PackageReference Include="CommunityToolkit.WinUI.Converters" />
52-
<PackageReference Include="DevTKSS.Extensions.Uno"/>
52+
<PackageReference Include="DevTKSS.Extensions.Uno" />
5353
</ItemGroup>
5454
<ItemGroup>
5555
<UnoImage Include="Assets\Images\*" />

src/DevTKSS.Uno.Samples.MvuxGallery/GlobalUsings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
global using DevTKSS.Uno.Samples.MvuxGallery.Presentation.ViewModels;
1010
global using DevTKSS.Uno.Samples.MvuxGallery.Presentation.Views;
1111
global using DevTKSS.Uno.Samples.MvuxGallery.Models.CodeSamples;
12+
global using DevTKSS.Uno.Samples.MvuxGallery.Models.GalleryImages;
1213
global using Microsoft.UI.Xaml.Data;
1314
global using System.Text.Json.Serialization;
1415
global using DevTKSS.Extensions.Uno.Storage;

src/DevTKSS.Uno.Samples.MvuxGallery/Models/CodeSamples/CodeSampleService.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
using Uno.Extensions.Reactive.Commands;
44

55
namespace DevTKSS.Uno.Samples.MvuxGallery.Models.CodeSamples;
6-
public class CodeSampleService
7-
{
6+
public record CodeSampleService : ICodeSampleService
7+
{
88
public CodeSampleService(
99
IOptions<CodeSampleOptionsConfiguration>? options,
1010
ILogger<CodeSampleService> logger,
@@ -18,18 +18,18 @@ public CodeSampleService(
1818
private readonly IStorage _storage;
1919
private readonly ILogger<CodeSampleService> _logger;
2020
private readonly Dictionary<string, CodeSampleOption[]> _codeSampleDict;
21-
21+
2222
public async ValueTask<ImmutableList<string>> GetCodeSampleOptions(string callerID, CancellationToken ct = default)
2323
{
2424
await Task.Delay(1, ct);
2525
return _codeSampleDict.UnoGetValueOrDefault(callerID)
2626
.SelectToList(sampleOptions => sampleOptions.Identifyer)
2727
.ToImmutableList();
2828
}
29-
29+
3030
public async Task<string> GetCodeSampleAsync(string callerID, string sampleID)
3131
{
32-
if(_codeSampleDict.TryGetValue(callerID, out var sampleOptions))
32+
if (_codeSampleDict.TryGetValue(callerID, out var sampleOptions))
3333
{
3434
var sampleOption = sampleOptions.FirstOrDefault(item => item.Identifyer == sampleID);
3535
return sampleOption == null
@@ -59,7 +59,7 @@ public async Task<string> GetCodeSampleAsync(string callerID, string sampleID)
5959
/// overload:<br/>
6060
/// `params ReadOnlySpan<string> items` this takes in an (e.g.) array of generic typed values
6161
/// </remarks>
62-
public static async ValueTask<IImmutableList<string>?> GetCodeSampleOptionsAsync<TOwner>(TOwner owner, CancellationToken ct = default)
62+
public async ValueTask<IImmutableList<string>> GetCodeSampleOptionsAsync<TOwner>(TOwner owner, CancellationToken ct = default)
6363
where TOwner : class
6464
{
6565
await Task.Delay(1, ct);
@@ -119,7 +119,7 @@ public async Task<string> GetCodeSampleAsync(string callerID, string sampleID)
119119
"C# in CounterModel"
120120
]);
121121
}
122-
else return default;
122+
else return ImmutableList<string>.Empty;
123123

124124
}
125125

@@ -132,10 +132,11 @@ public async Task<string> GetCodeSampleAsync(string callerID, string sampleID)
132132
/// <remarks>
133133
/// Uses switch expression to select the correct code sample which provides better performance and less boilerplate code.
134134
/// </remarks>
135-
public async ValueTask SwitchCodeSampleAsync(string? choice, CancellationToken ct = default)
135+
public async ValueTask<string> SwitchCodeSampleAsync(string? choice, CancellationToken ct = default)
136136
{
137137
_logger.LogTrace("SwitchCodeSampleAsync called with parameter: {choice}", choice);
138-
return choice switch
138+
139+
string selectedSample = choice switch
139140
{
140141
"C# in Model" => await _storage.ReadPackageFileAsync("Assets/Samples/ModelBinding-Sample.cs.txt"),
141142
"DI Service Resw" => await _storage.ReadPackageFileAsync("Assets/Samples/GalleryImageService-resw.cs.txt"),
@@ -144,6 +145,8 @@ public async ValueTask SwitchCodeSampleAsync(string? choice, CancellationToken c
144145
"XAML DataTemplate" => await _storage.ReadPackageFileAsync("Assets/Samples/Card-GalleryImage.DataTemplate.xaml.txt"),
145146
"FeedView + GridView XAML" => await _storage.ReadPackageFileAsync("Assets/Samples/FeedView-GridView-Sample.xaml.txt"),
146147
_ => string.Empty
147-
};
148+
} ?? string.Empty;
149+
return selectedSample;
148150
}
151+
149152
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
namespace DevTKSS.Uno.Samples.MvuxGallery.Models.CodeSamples;
3+
4+
public interface ICodeSampleService
5+
{
6+
ValueTask<IImmutableList<string>> GetCodeSampleOptionsAsync<TOwner>(TOwner owner, CancellationToken ct = default) where TOwner : class;
7+
Task<string> GetCodeSampleAsync(string callerID, string sampleID);
8+
ValueTask<ImmutableList<string>> GetCodeSampleOptions(string callerID, CancellationToken ct = default);
9+
ValueTask<string> SwitchCodeSampleAsync(string? choice, CancellationToken ct = default);
10+
}

src/DevTKSS.Uno.Samples.MvuxGallery/Models/GalleryImageModel.cs renamed to src/DevTKSS.Uno.Samples.MvuxGallery/Models/GalleryImages/GalleryImageModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
namespace DevTKSS.Uno.Samples.MvuxGallery.Models;
1+
namespace DevTKSS.Uno.Samples.MvuxGallery.Models.GalleryImages;
22

33
public partial record GalleryImageModel(string Title, string ImageLocation, string Description);

src/DevTKSS.Uno.Samples.MvuxGallery/Models/GalleryImageService.cs renamed to src/DevTKSS.Uno.Samples.MvuxGallery/Models/GalleryImages/GalleryImageService.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace DevTKSS.Uno.Samples.MvuxGallery.Models;
1+
namespace DevTKSS.Uno.Samples.MvuxGallery.Models.GalleryImages;
22
[Bindable]
33
public partial class GalleryImageService : IGalleryImageService
44
{
@@ -8,8 +8,8 @@ public GalleryImageService(
88
ILocalizationService localizationService,
99
IStringLocalizer _stringLocalizer)
1010
{
11-
this._localizationService = localizationService;
12-
this._stringlocalizer = _stringLocalizer;
11+
_localizationService = localizationService;
12+
_stringlocalizer = _stringLocalizer;
1313
}
1414

1515
public async ValueTask<IImmutableList<GalleryImageModel>> GetGalleryImagesWithReswAsync(CancellationToken ct)
@@ -25,7 +25,6 @@ public async ValueTask<IImmutableList<GalleryImageModel>> GetGalleryImagesWithou
2525
"en" => await GetENGalleryImagesAsync(ct),
2626
_ => await GetENGalleryImagesAsync(ct),
2727
};
28-
await Task.Delay(TimeSpan.FromSeconds(1));
2928
return galleryImages;
3029
}
3130

src/DevTKSS.Uno.Samples.MvuxGallery/Models/IGalleryImageService.cs renamed to src/DevTKSS.Uno.Samples.MvuxGallery/Models/GalleryImages/IGalleryImageService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace DevTKSS.Uno.Samples.MvuxGallery.Models;
1+
namespace DevTKSS.Uno.Samples.MvuxGallery.Models.GalleryImages;
22

33
public interface IGalleryImageService
44
{

0 commit comments

Comments
 (0)