Files
Samuele Locatelli 78361c3c2c Minor fixes
2023-08-29 11:49:20 +02:00

68 lines
1.7 KiB
C#

using Microsoft.AspNetCore.Components;
using WebDoorCreator.Data;
namespace WebDoorCreator.UI.Data
{
public class WDCRefreshService
{
#region Public Events
public event Action EA_UpdDoorOp = null!;
public event EventHandler EA_ConfDoorOp = delegate { };
#endregion Public Events
#region Public Properties
public bool isDoorOpUpd
{
get => _isDoorOpUpd;
set
{
_isDoorOpUpd = value;
reportDoorOpUpd();
}
}
#endregion Public Properties
#region Protected Methods
protected void reportDoorOpUpd()
{
if (EA_UpdDoorOp != null)
{
EA_UpdDoorOp?.Invoke();
}
}
public void ReportDoorOpConf(int doorId, int doorOpId, string objId)
{
DOPEventArgs currOpr = new DOPEventArgs()
{
DoorId = doorId,
DoorOpId = doorOpId,
ObjectId = objId
};
// se qualcuno ascolta sollevo evento nuovo valore...
if (EA_ConfDoorOp != null)
{
EA_ConfDoorOp(this, currOpr);
}
}
#endregion Protected Methods
#region Private Properties
private bool _isDoorOpUpd { get; set; } = false;
private bool _isDoorOpConf { get; set; } = false;
#endregion Private Properties
public class DOPEventArgs : EventArgs
{
public int DoorId { get; set; } = 0;
public int DoorOpId { get; set; } = 0;
public string ObjectId { get; set; } = "";
}
}
}