Skip to content

Commit e0fcd59

Browse files
committed
chore: resolving PR comments
1 parent fb1a7c1 commit e0fcd59

File tree

5 files changed

+83
-129
lines changed

5 files changed

+83
-129
lines changed

UI/MVUX/src/MVUX/MVUX.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
the "Microsoft.Windows.SDK.BuildTools" package above, and the "revision" version number
2727
must be the highest found in https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref.
2828
-->
29-
<!-- <WindowsSdkPackageVersion>10.0.22621.28</WindowsSdkPackageVersion> -->
3029

3130
<!--
3231
UnoFeatures let's you quickly add and manage implicit package references based on the features you want to use.
@@ -46,6 +45,7 @@
4645
Localization;
4746
Navigation;
4847
</UnoFeatures>
48+
<WindowsSdkPackageVersion>10.0.19041.38</WindowsSdkPackageVersion>
4949
</PropertyGroup>
5050

5151
</Project>

UI/MVUX/src/MVUX/Presentation/FeedViewSample/FeedViewPage.xaml

Lines changed: 65 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -5,115 +5,82 @@
55
xmlns:utu="using:Uno.Toolkit.UI"
66
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
77

8+
<!-- Reusable templates -->
9+
<Page.Resources>
10+
<DataTemplate x:Key="PersonDetailsTemplate">
11+
<Grid>
12+
<Grid.RowDefinitions>
13+
<RowDefinition Height="Auto" />
14+
<RowDefinition />
15+
</Grid.RowDefinitions>
16+
<StackPanel Grid.Row="1">
17+
<TextBlock Text="Selected Person Details:"
18+
FontWeight="Bold"
19+
FontSize="16" />
20+
<TextBlock>
21+
<Run Text="First Name: " />
22+
<Run Text="{Binding Data.FirstName}" />
23+
</TextBlock>
24+
<TextBlock>
25+
<Run Text="Last Name: " />
26+
<Run Text="{Binding Data.LastName}" />
27+
</TextBlock>
28+
<Button Grid.Row="0"
29+
Content="Refresh"
30+
Command="{Binding Refresh}"
31+
Margin="10" />
32+
</StackPanel>
33+
</Grid>
34+
</DataTemplate>
35+
36+
<!-- Custom Progress Template -->
37+
<DataTemplate x:Key="CustomProgressTemplate">
38+
<TextBlock Text="Loading person details, please wait..."
39+
HorizontalAlignment="Center"
40+
VerticalAlignment="Center" />
41+
</DataTemplate>
42+
43+
<!-- Error Template -->
44+
<DataTemplate x:Key="ErrorTemplate">
45+
<TextBlock Text="Failed to load person details. Please try again later."
46+
Foreground="Red"
47+
HorizontalAlignment="Center"
48+
VerticalAlignment="Center" />
49+
</DataTemplate>
50+
</Page.Resources>
51+
852
<Grid utu:SafeArea.Insets="Bottom,Top">
953
<StackPanel>
1054
<TextBlock Text="FeedView Sample: Default Loading, Custom Loading, and Error"
1155
FontSize="16"
1256
Margin="10"
1357
TextWrapping="Wrap" />
1458

15-
<!--Default Loading with FeedView -->
16-
<TextBlock Text="1. Default Loading:" FontWeight="Bold" FontSize="14" Margin="10,0"/>
17-
<mvux:FeedView Source="{Binding DefaultPerson}">
18-
<mvux:FeedView.ValueTemplate>
19-
<DataTemplate>
20-
<Grid>
21-
<Grid.RowDefinitions>
22-
<RowDefinition Height="Auto" />
23-
<RowDefinition />
24-
</Grid.RowDefinitions>
25-
<StackPanel Grid.Row="1">
26-
<TextBlock Text="Selected Person Details:"
27-
FontWeight="Bold"
28-
FontSize="16" />
29-
<TextBlock>
30-
<Run Text="First Name:" />
31-
<Run Text="{Binding Data.FirstName}" />
32-
</TextBlock>
33-
<TextBlock>
34-
<Run Text="Last Name:" />
35-
<Run Text="{Binding Data.LastName}" />
36-
</TextBlock>
37-
<Button Grid.Row="0"
38-
Content="Refresh"
39-
Command="{Binding Refresh}"
40-
Margin="10" />
41-
</StackPanel>
42-
</Grid>
43-
</DataTemplate>
44-
</mvux:FeedView.ValueTemplate>
45-
</mvux:FeedView>
59+
<!-- Default Loading with FeedView -->
60+
<TextBlock Text="1. Default Loading:"
61+
FontWeight="Bold"
62+
FontSize="14"
63+
Margin="10,0" />
64+
<mvux:FeedView Source="{Binding DefaultPerson}"
65+
ValueTemplate="{StaticResource PersonDetailsTemplate}" />
4666

4767
<!-- Custom Loading Message with FeedView -->
48-
<TextBlock Text="2. Custom Loading Message:" FontWeight="Bold" FontSize="14" Margin="10,20,0,0"/>
49-
<mvux:FeedView Source="{Binding CustomLoadingPerson}">
50-
<mvux:FeedView.ValueTemplate>
51-
<DataTemplate>
52-
<Grid>
53-
<Grid.RowDefinitions>
54-
<RowDefinition Height="Auto" />
55-
<RowDefinition />
56-
</Grid.RowDefinitions>
57-
<StackPanel Grid.Row="1">
58-
<TextBlock Text="Selected Person Details:"
59-
FontWeight="Bold"
60-
FontSize="16" />
61-
<TextBlock>
62-
<Run Text="First Name:" />
63-
<Run Text="{Binding Data.FirstName}" />
64-
</TextBlock>
65-
<TextBlock>
66-
<Run Text="Last Name:" />
67-
<Run Text="{Binding Data.LastName}" />
68-
69-
</TextBlock>
70-
71-
<Button Grid.Row="0"
72-
Content="Refresh"
73-
Command="{Binding Refresh}"
74-
Margin="10" />
75-
</StackPanel>
76-
</Grid>
77-
</DataTemplate>
78-
</mvux:FeedView.ValueTemplate>
79-
80-
<!-- Custom loading message -->
81-
<mvux:FeedView.ProgressTemplate>
82-
<DataTemplate>
83-
<TextBlock Text="Loading person details, please wait..."
84-
HorizontalAlignment="Center"
85-
VerticalAlignment="Center" />
86-
</DataTemplate>
87-
</mvux:FeedView.ProgressTemplate>
88-
</mvux:FeedView>
68+
<TextBlock Text="2. Custom Loading Message:"
69+
FontWeight="Bold"
70+
FontSize="14"
71+
Margin="10,20,0,0" />
72+
<mvux:FeedView Source="{Binding CustomLoadingPerson}"
73+
ValueTemplate="{StaticResource PersonDetailsTemplate}"
74+
ProgressTemplate="{StaticResource CustomProgressTemplate}" />
8975

9076
<!-- Error Handling in FeedView -->
91-
<TextBlock Text="3. Error Handling:" FontWeight="Bold" FontSize="14" Margin="10,20,0,0"/>
92-
<mvux:FeedView Source="{Binding ErrorPerson}">
93-
<mvux:FeedView.ValueTemplate>
94-
<DataTemplate>
95-
<StackPanel>
96-
<TextBlock Text="Selected Person Details:"
97-
FontWeight="Bold"
98-
FontSize="16" />
99-
<TextBlock Text="First Name:" />
100-
<TextBlock Text="{Binding Data.FirstName}" />
101-
<TextBlock Text="Last Name:" />
102-
<TextBlock Text="{Binding Data.LastName}" />
103-
</StackPanel>
104-
</DataTemplate>
105-
</mvux:FeedView.ValueTemplate>
106-
107-
<!-- Error template to display in case of an error -->
108-
<mvux:FeedView.ErrorTemplate>
109-
<DataTemplate>
110-
<TextBlock Text="Failed to load person details. Please try again later."
111-
Foreground="Red"
112-
HorizontalAlignment="Center"
113-
VerticalAlignment="Center" />
114-
</DataTemplate>
115-
</mvux:FeedView.ErrorTemplate>
116-
</mvux:FeedView>
77+
<TextBlock Text="3. Error Handling:"
78+
FontWeight="Bold"
79+
FontSize="14"
80+
Margin="10,20,0,0" />
81+
<mvux:FeedView Source="{Binding ErrorPerson}"
82+
ValueTemplate="{StaticResource PersonDetailsTemplate}"
83+
ErrorTemplate="{StaticResource ErrorTemplate}" />
11784
</StackPanel>
11885
</Grid>
11986
</Page>

UI/MVUX/src/MVUX/Presentation/SelectionSample/SelectionModel.cs

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,16 @@ namespace MVUX.Presentation.SelectionSample;
22

33
public partial record SelectionModel
44
{
5-
public IListFeed<Person> People { get; }
6-
7-
5+
public IListFeed<Person> People => ListFeed
6+
.Async(async ct =>
7+
{
8+
await Task.Delay(1000, ct);
9+
return ImmutableList.Create(
10+
new Person("Master", "Yoda"),
11+
new Person("Darth", "Vader"),
12+
new Person("Luke", "Skywalker")
13+
);
14+
})
15+
.Selection(SelectedPerson);
816
public IState<Person> SelectedPerson => State<Person>.Empty(this);
9-
10-
public SelectionModel()
11-
{
12-
13-
People = ListFeed
14-
.Async(async ct =>
15-
{
16-
await Task.Delay(1000, ct);
17-
return ImmutableList.Create(
18-
new Person("Master", "Yoda"),
19-
new Person("Darth", "Vader"),
20-
new Person("Luke", "Skywalker")
21-
);
22-
})
23-
.Selection(SelectedPerson);
24-
}
2517
}

UI/MVUX/src/MVUX/Presentation/UpdateStateSample/UpdateStateModel.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ public ValueTask ChangeValueIfGreaterThan(CancellationToken ct)
1818
{
1919
var newValue = GetRandomNumber();
2020
return newValue > number ? newValue : number;
21-
}, ct);
22-
23-
private readonly Random _random = new();
24-
21+
}, ct);
22+
2523
private int GetRandomNumber()
26-
=> _random.Next(0, 100);
24+
=> Random.Shared.Next(0, 100);
2725
}

UI/MVUX/src/global.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
// To update the version of Uno please update the version of the Uno.Sdk here. See https://aka.platform.uno/upgrade-uno-packages for more information.
3-
"msbuild-sdks": {
4-
"Uno.Sdk": "5.3.99"
5-
},
6-
"sdk":{
7-
"allowPrerelease": false
8-
}
3+
"msbuild-sdks": {
4+
"Uno.Sdk": "5.5.0-dev.44"
5+
}
96
}

0 commit comments

Comments
 (0)