Skip to content

Commit a380640

Browse files
committed
refactor: Move and rename files to provide better structure and avoid known issues with Styles folder
1 parent 4cfc95e commit a380640

File tree

4 files changed

+26
-32
lines changed

4 files changed

+26
-32
lines changed

src/DevTKSS.Uno.Samples.MvuxGallery/Styles/GalleryTemplates.xaml renamed to src/DevTKSS.Uno.Samples.MvuxGallery/DataTemplates/GalleryTemplates.xaml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
xmlns:mvux="using:Uno.Extensions.Reactive.UI">
88

99
<!--#region Card Template -->
10-
<DataTemplate x:Key="StyledCardTemplate" x:DataType="gi:GalleryImageModel">
10+
<DataTemplate x:Key="StyledCardTemplate" x:DataType="gi:GalleryImage">
1111
<utu:Card CornerRadius="20"
1212
HorizontalContentAlignment="Stretch"
1313
HeaderContent="{Binding Title}"
@@ -21,7 +21,7 @@
2121
MediaContentTemplate="{StaticResource CardMediaContentTemplate}"/>
2222
</DataTemplate>
2323
<!--#region Card HeaderContent Template-->
24-
<DataTemplate x:Key="CardHeaderContentTemplate" x:DataType="gi:GalleryImageModel">
24+
<DataTemplate x:Key="CardHeaderContentTemplate" x:DataType="gi:GalleryImage">
2525
<Border Background="{ThemeResource SurfaceInverseBrush}" Opacity=".7">
2626
<TextBlock Text="{Binding }"
2727
Style="{ThemeResource TitleLarge}"
@@ -33,7 +33,7 @@
3333
<!--#endregion-->
3434

3535
<!--#region Card SubHeaderContent Template-->
36-
<DataTemplate x:DataType="gi:GalleryImageModel" x:Key="CardSubHeaderContentTemplate">
36+
<DataTemplate x:DataType="gi:GalleryImage" x:Key="CardSubHeaderContentTemplate">
3737
<Border Background="{ThemeResource SurfaceInverseBrush}" Opacity=".7">
3838
<TextBlock Text="{Binding }"
3939
Style="{ThemeResource BodySmall}"
@@ -45,7 +45,7 @@
4545
<!--#endregion-->
4646

4747
<!--#region Card MediaContentTemplate-->
48-
<DataTemplate x:DataType="gi:GalleryImageModel" x:Key="CardMediaContentTemplate">
48+
<DataTemplate x:DataType="gi:GalleryImage" x:Key="CardMediaContentTemplate">
4949
<Image Source="{Binding }"
5050
Stretch="Uniform"
5151
Width="{utu:AncestorBinding AncestorType=utu:Card, Path=Width}" />
@@ -92,7 +92,7 @@
9292
<!-- This Sample is a simplifyed Template using a regular Grid with a unified Layout-->
9393
<!-- Reference used: WinUi 3 Gallery GridView "ItemOverlayTemplate" winui3gallery://item/GridView -->
9494

95-
<DataTemplate x:Key="GalleryImageOverlayTemplate" x:DataType="gi:GalleryImageModel">
95+
<DataTemplate x:Key="GalleryImageOverlayTemplate" x:DataType="gi:GalleryImage">
9696
<Grid HorizontalAlignment="Stretch"
9797
VerticalAlignment="Stretch"
9898
CornerRadius="20"
@@ -137,14 +137,22 @@
137137
<!--#endregion-->
138138

139139
<!--#region TabBarItem Template-->
140-
<DataTemplate x:Key="BottomTabBarItemTemplate">
141-
<utu:TabBarItem Content="{Binding }"
142-
HorizontalAlignment="Center"
143-
HorizontalContentAlignment="Center"
144-
Style="{StaticResource BottomTabBarItemStyle}">
145-
<utu:TabBarItem.Icon>
146-
<FontIcon Glyph="&#xE943;" />
147-
</utu:TabBarItem.Icon>
140+
141+
<DataTemplate x:Key="SelectorDropDown">
142+
<ComboBox ItemsSource="{Binding }"
143+
HorizontalContentAlignment="Center"
144+
HorizontalAlignment="Stretch" />
145+
146+
</DataTemplate>
147+
<DataTemplate x:Key="BottomTabBarItemTemplate">
148+
149+
<utu:TabBarItem Content="{Binding }"
150+
HorizontalAlignment="Center"
151+
HorizontalContentAlignment="Center"
152+
Style="{StaticResource BottomTabBarItemStyle}">
153+
<utu:TabBarItem.Icon>
154+
<FontIcon Glyph="&#xE943;" />
155+
</utu:TabBarItem.Icon>
148156
</utu:TabBarItem>
149157
</DataTemplate>
150158
<!--#endregion-->

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

File renamed without changes.

src/DevTKSS.Uno.Samples.MvuxGallery/Models/CodeSamples/CodeSampleService.cs renamed to src/DevTKSS.Uno.Samples.MvuxGallery/Services/CodeSampleService.cs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
namespace DevTKSS.Uno.Samples.MvuxGallery.Models.CodeSamples;
1+
namespace DevTKSS.Uno.Samples.MvuxGallery.Services;
22
public partial record CodeSampleService : ICodeSampleService
33
{
44
private readonly IStorage _storage;
55
private readonly ILogger<CodeSampleService> _logger;
66

7-
private CodeSampleOptions _options;
7+
private readonly CodeSampleOptions _options;
88

99
public string Name { get; init; }
1010

1111
public CodeSampleService(
1212
string name,
13-
IOptionsMonitor<CodeSampleOptions> options,
13+
IOptionsSnapshot<CodeSampleOptions> options,
1414
ILogger<CodeSampleService> logger,
1515
IStorage storage)
1616
{
@@ -22,20 +22,6 @@ public CodeSampleService(
2222
{
2323
_logger.LogInformation("CodeSampleService created for '{ServiceName}', loaded {SampleCount} samples", Name, _options.Samples.Length);
2424
}
25-
26-
options.OnChange(UpdateOptions);
27-
}
28-
public void UpdateOptions(CodeSampleOptions newOptions, string? changedOption)
29-
{
30-
if (_logger.IsEnabled(LogLevel.Debug))
31-
{
32-
_logger.LogDebug("CodeSampleOptions changed for {name}", changedOption);
33-
}
34-
if (changedOption == Name)
35-
{
36-
_logger.LogInformation("Updating CodeSampleOptions for {serviceName}", Name);
37-
_options = newOptions;
38-
}
3925
}
4026

4127
/// <summary>

src/DevTKSS.Uno.Samples.MvuxGallery/Models/CodeSamples/ICodeSampleService.cs renamed to src/DevTKSS.Uno.Samples.MvuxGallery/Services/ICodeSampleService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
namespace DevTKSS.Uno.Samples.MvuxGallery.Models.CodeSamples;
2+
namespace DevTKSS.Uno.Samples.MvuxGallery.Services;
33

44
public interface ICodeSampleService
55
{
@@ -10,7 +10,7 @@ public interface ICodeSampleService
1010
/// <param name="sampleID">The identifier of the sample.</param>
1111
/// <param name="ct">A cancellation token for the operation.</param>
1212
/// <returns>The content of the code sample.</returns>
13-
public ValueTask<string> GetCodeSampleAsync(string sampleID,CancellationToken ct = default);
13+
public ValueTask<string> GetCodeSampleAsync(string sampleID, CancellationToken ct = default);
1414

1515
/// <summary>
1616
/// Get a static collection of values for code sample options asynchronously.

0 commit comments

Comments
 (0)