Files
ersatztv/ErsatzTV/Pages/FragmentNavigationBase.cs
T
Jason DoveandGitHub c240169fc9 add multiselect and movie tags (#62)
* add basic selection behavior to search results

* add search scrolling, selection actions

* include shows in multiselect

* multiselect movies, shows, collection items

* add movie and show tags

* code cleanup

* update show screenshot
2021-03-11 18:49:00 +00:00

34 lines
1021 B
C#

using System;
using System.Threading.Tasks;
using ErsatzTV.Extensions;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.JSInterop;
namespace ErsatzTV.Pages
{
public class FragmentNavigationBase : ComponentBase, IDisposable
{
[Inject]
private NavigationManager NavManager { get; set; }
[Inject]
private IJSRuntime JsRuntime { get; set; }
public void Dispose() => NavManager.LocationChanged -= TryFragmentNavigation;
protected override void OnInitialized() => NavManager.LocationChanged += TryFragmentNavigation;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await NavManager.NavigateToFragmentAsync(JsRuntime);
}
}
private async void TryFragmentNavigation(object sender, LocationChangedEventArgs args) =>
await NavManager.NavigateToFragmentAsync(JsRuntime);
}
}