Skip to content

Commit 8ba652f

Browse files
committed
Feedback updates
1 parent 0dc733e commit 8ba652f

File tree

12 files changed

+32
-17
lines changed

12 files changed

+32
-17
lines changed

OwnerModule/Handlers/DeleteEventHandlers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public async Task Handle(DeleteVehicleEvent @event, CancellationToken cancellati
1212
{
1313
await data.DeleteByVehicle(@event.VehicleId, cancellationToken);
1414

15-
// this tells bulti-in mediator components to bust their cache values
15+
// this tells built-in mediator components to bust their cache values
1616
await mediator.FlushAllStores(cancellationToken);
1717
}
1818

OwnerModule/LinkViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public override async void OnNavigatedTo(INavigationParameters parameters)
3838
base.OnNavigatedTo(parameters);
3939
if (parameters.IsNewNavigation())
4040
{
41-
var request = parameters.Get<LinkNavRequest>();
41+
var request = parameters.GetRequired<LinkNavRequest>();
4242
await Task.WhenAll(this.BindPeople(), this.BindVehicles());
4343

4444
if (request.PersonId == null)

PeopleModule.Contracts/Routes.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ namespace PeopleModule;
22

33
public static class Routes
44
{
5-
public static string List = "People";
6-
public static string Detail = "Person";
5+
public const string List = "People";
6+
public const string Detail = "Person";
77
}

PeopleModule/DetailViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public override async void OnNavigatedTo(INavigationParameters parameters)
1515

1616
if (parameters.IsNewNavigation())
1717
{
18-
var request = parameters.Get<DetailNavRequest>()!;
18+
var request = parameters.GetRequired<DetailNavRequest>();
1919
this.person = await data.GetById(request.PersonId, CancellationToken.None);
2020
this.Title = this.person!.FullName;
2121

PeopleModule/ListPage.xaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
44
xmlns:peopleModule="clr-namespace:PeopleModule"
55
xmlns:contracts="clr-namespace:PeopleModule.Contracts;assembly=PeopleModule.Contracts"
6+
xmlns:skeleton="clr-namespace:Maui.Skeleton;assembly=Maui.Skeleton"
67
NavigationPage.BackButtonTitle="Back"
78
x:DataType="peopleModule:ListViewModel"
89
x:Class="PeopleModule.ListPage"
@@ -12,7 +13,10 @@
1213
IsRefreshing="{Binding IsBusy}">
1314
<CollectionView ItemsSource="{Binding List}"
1415
SelectionMode="Single"
15-
SelectedItem="{Binding SelectedPerson}">
16+
SelectedItem="{Binding SelectedPerson}"
17+
skeleton:Skeleton.IsParent="True"
18+
skeleton:Skeleton.IsBusy="{Binding IsBusy}"
19+
skeleton:Skeleton.Animation="{skeleton:DefaultAnimation Fade}">
1620
<CollectionView.EmptyView>
1721
<Label Text="No People Found"
1822
FontSize="Large"

PeopleModule/PeopleModule.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<ItemGroup>
1010
<ProjectReference Include="..\SharedLib\SharedLib.csproj"/>
1111
<PackageReference Include="Bogus" Version="35.5.1"/>
12+
<PackageReference Include="HorusStudio.Maui.Skeleton" Version="2.0.0" />
1213
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41"/>
1314
</ItemGroup>
1415
</Project>

SharedLib/Extensions.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ namespace SharedLib;
22

33
public static class Extensions
44
{
5-
public static T? Get<T>(this INavigationParameters parameters)
6-
=> parameters.GetValue<T>(typeof(T).Name);
7-
8-
public static (string, TRequest) ToNavParam<TRequest>(this TRequest request) where TRequest : IRequest
9-
=> (request.GetType().Name, request);
5+
public static T GetRequired<T>(this INavigationParameters parameters)
6+
{
7+
var key = typeof(T).Name;
8+
if (!parameters.ContainsKey(key))
9+
throw new InvalidOperationException($"NavParameter '{key}' was not found");
10+
11+
return parameters.GetValue<T>(key);
12+
}
1013
}

VehicleModule.Contracts/Routes.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ namespace VehicleModule;
22

33
public static class Routes
44
{
5-
public static string List = "Animals";
6-
public static string Detail = "Animal";
5+
public const string List = "Animals";
6+
public const string Detail = "Animal";
77
}

VehicleModule/DetailViewModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ IMediator mediator
1515
public override async void OnNavigatedTo(INavigationParameters parameters)
1616
{
1717
base.OnNavigatedTo(parameters);
18-
var request = parameters.Get<DetailNavRequest>()!;
1918

2019
if (parameters.IsNewNavigation())
2120
{
21+
var request = parameters.GetRequired<DetailNavRequest>();
22+
2223
// go idea to safety this
2324
this.vehicle = await data.GetById(request.VehicleId, CancellationToken.None);
2425
this.Title = this.vehicle!.Name;

VehicleModule/ListPage.xaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
44
xmlns:vehicleModule="clr-namespace:VehicleModule"
55
xmlns:contracts="clr-namespace:VehicleModule.Contracts;assembly=VehicleModule.Contracts"
6+
xmlns:skeleton="clr-namespace:Maui.Skeleton;assembly=Maui.Skeleton"
67
NavigationPage.BackButtonTitle="Back"
78
x:DataType="vehicleModule:ListViewModel"
89
x:Class="VehicleModule.ListPage"
@@ -12,7 +13,10 @@
1213
IsRefreshing="{Binding IsBusy}">
1314
<CollectionView ItemsSource="{Binding List}"
1415
SelectionMode="Single"
15-
SelectedItem="{Binding SelectedVehicle}">
16+
SelectedItem="{Binding SelectedVehicle}"
17+
skeleton:Skeleton.IsParent="True"
18+
skeleton:Skeleton.IsBusy="{Binding IsBusy}"
19+
skeleton:Skeleton.Animation="{skeleton:DefaultAnimation Fade}">
1620
<CollectionView.EmptyView>
1721
<Label Text="No Vehicles Found"
1822
FontSize="Large"

0 commit comments

Comments
 (0)