Skip to content

Commit e32ce28

Browse files
authored
Applied API review changes. (#61152)
1 parent 7ab2cc4 commit e32ce28

File tree

5 files changed

+27
-9
lines changed

5 files changed

+27
-9
lines changed

src/Components/Components/src/NavigationManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public event EventHandler<LocationChangedEventArgs> LocationChanged
3838
/// <summary>
3939
/// An event that fires when the page is not found.
4040
/// </summary>
41-
public event EventHandler<EventArgs> NotFoundEvent
41+
public event EventHandler<NotFoundEventArgs> OnNotFound
4242
{
4343
add
4444
{
@@ -52,7 +52,7 @@ public event EventHandler<EventArgs> NotFoundEvent
5252
}
5353
}
5454

55-
private EventHandler<EventArgs>? _notFound;
55+
private EventHandler<NotFoundEventArgs>? _notFound;
5656

5757
// For the baseUri it's worth storing as a System.Uri so we can do operations
5858
// on that type. System.Uri gives us access to the original string anyway.
@@ -199,11 +199,11 @@ public virtual void Refresh(bool forceReload = false)
199199
/// <summary>
200200
/// Handles setting the NotFound state.
201201
/// </summary>
202-
public virtual void NotFound() => NotFoundCore();
202+
public void NotFound() => NotFoundCore();
203203

204204
private void NotFoundCore()
205205
{
206-
_notFound?.Invoke(this, new EventArgs());
206+
_notFound?.Invoke(this, new NotFoundEventArgs());
207207
}
208208

209209
/// <summary>

src/Components/Components/src/PublicAPI.Unshipped.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#nullable enable
2-
Microsoft.AspNetCore.Components.NavigationManager.NotFoundEvent -> System.EventHandler<System.EventArgs!>!
3-
virtual Microsoft.AspNetCore.Components.NavigationManager.NotFound() -> void
2+
Microsoft.AspNetCore.Components.NavigationManager.OnNotFound -> System.EventHandler<Microsoft.AspNetCore.Components.Routing.NotFoundEventArgs!>!
3+
Microsoft.AspNetCore.Components.NavigationManager.NotFound() -> void
4+
Microsoft.AspNetCore.Components.Routing.NotFoundEventArgs
5+
Microsoft.AspNetCore.Components.Routing.NotFoundEventArgs.NotFoundEventArgs() -> void
46
Microsoft.AspNetCore.Components.Infrastructure.ComponentStatePersistenceManager.ComponentStatePersistenceManager(Microsoft.Extensions.Logging.ILogger<Microsoft.AspNetCore.Components.Infrastructure.ComponentStatePersistenceManager!>! logger, System.IServiceProvider! serviceProvider) -> void
57
Microsoft.AspNetCore.Components.Infrastructure.ComponentStatePersistenceManager.SetPlatformRenderMode(Microsoft.AspNetCore.Components.IComponentRenderMode! renderMode) -> void
68
Microsoft.AspNetCore.Components.Infrastructure.RegisterPersistentComponentStateServiceCollectionExtensions
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
namespace Microsoft.AspNetCore.Components.Routing;
5+
6+
/// <summary>
7+
/// <see cref="EventArgs" /> for <see cref="NavigationManager.OnNotFound" />.
8+
/// </summary>
9+
public sealed class NotFoundEventArgs : EventArgs
10+
{
11+
/// <summary>
12+
/// Initializes a new instance of <see cref="NotFoundEventArgs" />.
13+
/// </summary>
14+
public NotFoundEventArgs()
15+
{ }
16+
}

src/Components/Components/src/Routing/Router.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void Attach(RenderHandle renderHandle)
105105
_baseUri = NavigationManager.BaseUri;
106106
_locationAbsolute = NavigationManager.Uri;
107107
NavigationManager.LocationChanged += OnLocationChanged;
108-
NavigationManager.NotFoundEvent += OnNotFound;
108+
NavigationManager.OnNotFound += OnNotFound;
109109
RoutingStateProvider = ServiceProvider.GetService<IRoutingStateProvider>();
110110

111111
if (HotReloadManager.Default.MetadataUpdateSupported)
@@ -147,7 +147,7 @@ public async Task SetParametersAsync(ParameterView parameters)
147147
public void Dispose()
148148
{
149149
NavigationManager.LocationChanged -= OnLocationChanged;
150-
NavigationManager.NotFoundEvent -= OnNotFound;
150+
NavigationManager.OnNotFound -= OnNotFound;
151151
if (HotReloadManager.Default.MetadataUpdateSupported)
152152
{
153153
HotReloadManager.Default.OnDeltaApplied -= ClearRouteCaches;

src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ internal async Task InitializeStandardComponentServicesAsync(
8383

8484
if (navigationManager != null)
8585
{
86-
navigationManager.NotFoundEvent += SetNotFoundResponse;
86+
navigationManager.OnNotFound += SetNotFoundResponse;
8787
}
8888

8989
var authenticationStateProvider = httpContext.RequestServices.GetService<AuthenticationStateProvider>();

0 commit comments

Comments
 (0)