You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
934 B
54 lines
934 B
using Model.Feedback; |
|
|
|
namespace Services.Website; |
|
|
|
public class TooltipService : ITooltipService |
|
{ |
|
private readonly List<TooltipModel> tooltips = new(); |
|
|
|
public void Subscribe(Action action) |
|
{ |
|
OnChange += action; |
|
} |
|
|
|
public void Unsubscribe(Action action) |
|
{ |
|
OnChange += action; |
|
} |
|
|
|
public void AddTooltip(TooltipModel tooltip) |
|
{ |
|
tooltips.Insert(0, tooltip); |
|
|
|
NotifyDataChanged(); |
|
} |
|
|
|
public void RemoveTooltip(TooltipModel tooltip) |
|
{ |
|
tooltips.Remove(tooltip); |
|
} |
|
|
|
public bool HasTooltips() |
|
{ |
|
return tooltips.Count > 0; |
|
} |
|
|
|
public List<TooltipModel> GetTooltips() |
|
{ |
|
return tooltips; |
|
} |
|
|
|
|
|
public void ClearAllTooltips() |
|
{ |
|
tooltips.Clear(); |
|
NotifyDataChanged(); |
|
} |
|
|
|
private event Action OnChange = null!; |
|
|
|
private void NotifyDataChanged() |
|
{ |
|
OnChange(); |
|
} |
|
} |