コード例 #1
0
ファイル: EventSource.cs プロジェクト: Qoden/Qoden.Binding
 /// <summary>
 /// Listen to the event on this object
 /// </summary>
 /// <param name="owner">Object to subscribe to</param>
 /// <param name="replacementSender">Replace sender in the callback with this object if it is not null</param>
 public void Listen(T owner, object replacementSender = null)
 {
     Owners.Add(owner);
     replacementSenders.Add(replacementSender);
     if (subscriptions > 0)
     {
         @event.AddEventHandler(owner, eventHandler);
     }
 }
コード例 #2
0
ファイル: EventSource.cs プロジェクト: tretikoff/Hogwarts
 /// <summary>
 /// Listen to the event on this object
 /// </summary>
 /// <param name="owner">Object to subscribe to</param>
 public void Listen(T owner)
 {
     Assert.Argument(owner, nameof(owner)).NotNull();
     Owners.Add(owner);
     if (_subscriptions > 0)
     {
         _event.AddEventHandler(owner, _eventHandler);
     }
 }