Just add a normal event to your singleton class:
public class Listener
{
//declare a delegate for the event
public delegate void InformationDelegate(DateTime timestamp);
//declare the event using the delegate
public event InformationDelegate Information;
public void SomeFunction()
{
// do something...
if(Information != null)
{
Information(DateTime.Now);
}
}
// singleton handling etc...
}
Then every object that wants to get informed registers itself on the singleton instance:
class SomeUIClass
{
void AFunction()
{
Listener.Instance.Information += InformationHandling;
}
public void InformationHandling(DateTime timestamp)
{
// do something with the information
}
}
Thanks to @Kami for clarifying the topic!