コード例 #1
0
 public void Listen(ModestTree.Util.Action <TParam1, TParam2, TParam3, TParam4, TParam5> listener)
 {
     Assert.That(!_listeners.Contains(listener),
                 () => "Tried to add method '{0}' to signal '{1}' but it has already been added"
                 .Fmt(listener.ToDebugString(), this.GetType().Name));
     _listeners.Add(listener);
 }
コード例 #2
0
        public void Unlisten(ModestTree.Util.Action <TParam1, TParam2, TParam3, TParam4, TParam5> listener)
        {
            bool success = _listeners.Remove(listener);

            Assert.That(success,
                        () => "Tried to remove method '{0}' from signal '{1}' without adding it first"
                        .Fmt(listener.ToDebugString(), this.GetType().Name));
        }