74 lines
1.6 KiB
C#
74 lines
1.6 KiB
C#
using MagMan.Data.Tenant.Services;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace MagMan.UI.Components
|
|
{
|
|
public partial class SearchMod : IDisposable
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public EventCallback<string> searchUpdated { get; set; }
|
|
|
|
//[Parameter]
|
|
public string searchVal
|
|
{
|
|
get
|
|
{
|
|
return MessageService.SearchVal;
|
|
}
|
|
set
|
|
{
|
|
MessageService.SearchVal = value;
|
|
reportChange();
|
|
}
|
|
}
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Public Methods
|
|
|
|
public void Dispose()
|
|
{
|
|
NavMan.LocationChanged -= NavMan_LocationChanged;
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Protected Methods
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
NavMan.LocationChanged += NavMan_LocationChanged;
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Properties
|
|
|
|
[Inject]
|
|
private NavigationManager NavMan { get; set; } = null!;
|
|
|
|
#endregion Private Properties
|
|
|
|
#region Private Methods
|
|
|
|
private void NavMan_LocationChanged(object? sender, Microsoft.AspNetCore.Components.Routing.LocationChangedEventArgs e)
|
|
{
|
|
reset();
|
|
}
|
|
|
|
private void reportChange()
|
|
{
|
|
searchUpdated.InvokeAsync(searchVal);
|
|
}
|
|
|
|
private void reset()
|
|
{
|
|
searchVal = "";
|
|
InvokeAsync(StateHasChanged);
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |