Ejemplo n.º 1
0
 public void SubscribeWithWeakEventListener(EventSource source)
 {
     _weakListener  = new WeakEventListener <EventSubscriber, EventSource, SignalArgs>(this, source);
     source.Signal += _weakListener.OnEvent;
     _weakListener.OnEventAction  = Respond;
     _weakListener.OnDetachAction = UnsubscribeWeakListener;
 }
Ejemplo n.º 2
0
 public static void UnsubscribeWeakListener(WeakEventListener <EventSubscriber, EventSource, SignalArgs> listener,
                                            EventSource source)
 {
     source.Signal -= listener.OnEvent;
     Console.WriteLine("WeakEventListener unsubscribed");
 }