Files
mapo-core/MP.Land/Data/MessageService.cs
T
Samuele Locatelli 9690e26194 LAND:
- fix auth annuale x home e footer
2023-10-16 10:59:47 +02:00

194 lines
4.1 KiB
C#

using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Timers;
namespace MP.Land.Data
{
public class MessageService
{
#region Private Fields
private string _pageIcon;
private string _pageName;
private string _searchVal = "";
private bool _yearAuth = false;
private SelectData _selFilter = SelectData.Init(4, 15);
private bool showSearch;
#endregion Private Fields
#region Public Events
public event Action EA_FilterUpdated;
public event Action EA_HideSearch;
public event Action EA_PageUpdated;
public event Action EA_SearchUpdated;
public event Action EA_ShowSearch;
public event Action EA_UpdateLic;
#endregion Public Events
#region Public Properties
public string PageIcon
{
get => _pageIcon;
set
{
if (_pageIcon != value)
{
_pageIcon = value;
ReportPageUpd();
}
}
}
public string PageName
{
get => _pageName;
set
{
if (_pageName != value)
{
_pageName = value;
ReportPageUpd();
}
}
}
public string SearchVal
{
get => _searchVal;
set
{
if (_searchVal != value)
{
_searchVal = value;
ReportSearch();
}
}
}
public SelectData SelFilter
{
get => _selFilter;
set
{
if (_selFilter != value)
{
_selFilter = value;
ReportFilter();
}
}
}
public bool ShowSearch
{
get => showSearch;
set
{
if (showSearch != value)
{
showSearch = value;
if (showSearch)
{
ReportShowSearch();
}
else
{
ReportHideSearch();
}
}
}
}
protected string _groupName { get; set; } = "";
public string CodGruppo
{
get => _groupName;
set
{
if (_groupName != value)
{
_groupName = value;
ReportFilter();
}
}
}
#endregion Public Properties
#region Private Methods
private void ReportFilter()
{
if (EA_FilterUpdated != null)
{
EA_FilterUpdated?.Invoke();
}
}
private void ReportHideSearch()
{
if (EA_HideSearch != null)
{
EA_HideSearch?.Invoke();
}
}
private void ReportPageUpd()
{
if (EA_PageUpdated != null)
{
EA_PageUpdated?.Invoke();
}
}
private void ReportSearch()
{
if (EA_SearchUpdated != null)
{
EA_SearchUpdated?.Invoke();
}
}
private void ReportShowSearch()
{
if (EA_ShowSearch != null)
{
EA_ShowSearch?.Invoke();
}
}
public bool YearAuth
{
get => _yearAuth;
set
{
if (_yearAuth != value)
{
_yearAuth = value;
ReportYearAuth();
}
}
}
public void ReportYearAuth()
{
if (EA_UpdateLic != null)
{
EA_UpdateLic?.Invoke();
}
}
#endregion Private Methods
}
}