Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Components/Components/src/NavigationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public event EventHandler<LocationChangedEventArgs> LocationChanged
/// <summary>
/// An event that fires when the page is not found.
/// </summary>
public event EventHandler<EventArgs> NotFoundEvent
public event EventHandler<NotFoundEventArgs> OnNotFound
{
add
{
Expand All @@ -52,7 +52,7 @@ public event EventHandler<EventArgs> NotFoundEvent
}
}

private EventHandler<EventArgs>? _notFound;
private EventHandler<NotFoundEventArgs>? _notFound;

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

private void NotFoundCore()
{
_notFound?.Invoke(this, new EventArgs());
_notFound?.Invoke(this, new NotFoundEventArgs());
}

/// <summary>
Expand Down
6 changes: 4 additions & 2 deletions src/Components/Components/src/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#nullable enable
Microsoft.AspNetCore.Components.NavigationManager.NotFoundEvent -> System.EventHandler<System.EventArgs!>!
virtual Microsoft.AspNetCore.Components.NavigationManager.NotFound() -> void
Microsoft.AspNetCore.Components.NavigationManager.OnNotFound -> System.EventHandler<Microsoft.AspNetCore.Components.Routing.NotFoundEventArgs!>!
Microsoft.AspNetCore.Components.NavigationManager.NotFound() -> void
Microsoft.AspNetCore.Components.Routing.NotFoundEventArgs
Microsoft.AspNetCore.Components.Routing.NotFoundEventArgs.NotFoundEventArgs() -> void
Microsoft.AspNetCore.Components.Infrastructure.ComponentStatePersistenceManager.ComponentStatePersistenceManager(Microsoft.Extensions.Logging.ILogger<Microsoft.AspNetCore.Components.Infrastructure.ComponentStatePersistenceManager!>! logger, System.IServiceProvider! serviceProvider) -> void
Microsoft.AspNetCore.Components.Infrastructure.ComponentStatePersistenceManager.SetPlatformRenderMode(Microsoft.AspNetCore.Components.IComponentRenderMode! renderMode) -> void
Microsoft.AspNetCore.Components.Infrastructure.RegisterPersistentComponentStateServiceCollectionExtensions
Expand Down
16 changes: 16 additions & 0 deletions src/Components/Components/src/Routing/NotFoundEventArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Microsoft.AspNetCore.Components.Routing;

/// <summary>
/// <see cref="EventArgs" /> for <see cref="NavigationManager.OnNotFound" />.
/// </summary>
public sealed class NotFoundEventArgs : EventArgs
{
/// <summary>
/// Initializes a new instance of <see cref="NotFoundEventArgs" />.
/// </summary>
public NotFoundEventArgs()
{ }
}
4 changes: 2 additions & 2 deletions src/Components/Components/src/Routing/Router.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void Attach(RenderHandle renderHandle)
_baseUri = NavigationManager.BaseUri;
_locationAbsolute = NavigationManager.Uri;
NavigationManager.LocationChanged += OnLocationChanged;
NavigationManager.NotFoundEvent += OnNotFound;
NavigationManager.OnNotFound += OnNotFound;
RoutingStateProvider = ServiceProvider.GetService<IRoutingStateProvider>();

if (HotReloadManager.Default.MetadataUpdateSupported)
Expand Down Expand Up @@ -147,7 +147,7 @@ public async Task SetParametersAsync(ParameterView parameters)
public void Dispose()
{
NavigationManager.LocationChanged -= OnLocationChanged;
NavigationManager.NotFoundEvent -= OnNotFound;
NavigationManager.OnNotFound -= OnNotFound;
if (HotReloadManager.Default.MetadataUpdateSupported)
{
HotReloadManager.Default.OnDeltaApplied -= ClearRouteCaches;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ internal async Task InitializeStandardComponentServicesAsync(

if (navigationManager != null)
{
navigationManager.NotFoundEvent += SetNotFoundResponse;
navigationManager.OnNotFound += SetNotFoundResponse;
}

var authenticationStateProvider = httpContext.RequestServices.GetService<AuthenticationStateProvider>();
Expand Down
Loading