76 lines
1.8 KiB
C#
76 lines
1.8 KiB
C#
using MagMan.Core.Services;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace MagMan.UI.Shared
|
|
{
|
|
public partial class MainLayout : IDisposable
|
|
{
|
|
#region Public Methods
|
|
|
|
public void Dispose()
|
|
{
|
|
AppMService.EA_ShowSearch -= OnShowSearch;
|
|
AppMService.EA_ShowSearch -= OnHideSearch;
|
|
}
|
|
|
|
public void OnHideSearch()
|
|
{
|
|
ShowSearch = false;
|
|
InvokeAsync(() =>
|
|
{
|
|
StateHasChanged();
|
|
});
|
|
}
|
|
|
|
public void OnShowSearch()
|
|
{
|
|
ShowSearch = true;
|
|
InvokeAsync(() =>
|
|
{
|
|
StateHasChanged();
|
|
});
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected MessageService AppMService { get; set; } = null!;
|
|
|
|
protected bool navLarge { get; set; } = true;
|
|
protected string sideClass { get; set; } = "sidebar";
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
AppMService.EA_ShowSearch += OnShowSearch;
|
|
AppMService.EA_HideSearch += OnHideSearch;
|
|
AppMService.EA_ShowCustomers += AppMService_EA_ShowCustomers;
|
|
}
|
|
|
|
private void AppMService_EA_ShowCustomers(bool obj)
|
|
{
|
|
ShowCustomers = obj;
|
|
}
|
|
|
|
protected void UpdateNavDisplay()
|
|
{
|
|
navLarge = !navLarge;
|
|
sideClass = navLarge ? "sidebar" : "sidebarSmall";
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Properties
|
|
|
|
private bool ShowSearch { get; set; } = false;
|
|
|
|
private bool ShowCustomers { get; set; } = false;
|
|
|
|
#endregion Private Properties
|
|
}
|
|
} |