diff --git a/GPW.CORE.UI/Data/SharedService.cs b/GPW.CORE.UI/Data/SharedService.cs new file mode 100644 index 0000000..d6530b9 --- /dev/null +++ b/GPW.CORE.UI/Data/SharedService.cs @@ -0,0 +1,66 @@ +using GPW.CORE.Data; + +namespace GPW.CORE.UI.Data +{ + /// + /// Servizi e dati condivisi a livello applicazione + /// + public class SharedService + { + #region Private Fields + + private List _activList = new List(); + + #endregion Private Fields + + #region Public Events + + public event Action EA_InfoUpdated = null!; + + #endregion Public Events + + #region Public Properties + + public List ActivList + { + get => _activList; + set + { + if (_activList != value) + { + _activList = value; + + if (EA_InfoUpdated != null) + { + EA_InfoUpdated?.Invoke(); + } + } + } + } + + public string Installazione { get; set; } = ""; + public string Applicazione { get; set; } = ""; + public string MasterKey { get; set; } = ""; + + public bool ValidData + { + get => !string.IsNullOrEmpty(Installazione) && !string.IsNullOrEmpty(Applicazione) && !string.IsNullOrEmpty(MasterKey) && ActivList != null && ActivList.Count > 0; + } + + public DateTime infoExpiry { get; set; } = DateTime.Today.AddDays(1); + + #endregion Public Properties + + #region Private Methods + + private void ReportUpdated() + { + if (EA_InfoUpdated != null) + { + EA_InfoUpdated?.Invoke(); + } + } + + #endregion Private Methods + } +} \ No newline at end of file