public void AddCallBack(IntervalCallBack callBack) { if (callBack == null) { throw new ArgumentNullException("callBack"); } lock (this._item.CallBackList.SyncRoot) { if (!this._item.CallBackList.Contains(callBack)) { this._item.CallBackList.Add(callBack); } } }
public void RemoveCallBack(IntervalCallBack callBack) { if (callBack == null) { throw new ArgumentNullException("method"); } lock (this._item.CallBackList.SyncRoot) { if (this._item.CallBackList.Contains(callBack)) { this._item.CallBackList.Remove(callBack); } } }
private static void CallBackList(object state) { if (state == null) { throw new ArgumentNullException("state"); } ArrayList list = null; IntervalCallBack back = null; list = state as ArrayList; if (list == null) { throw new ArgumentException("state not is ArrayList"); } for (int i = 0; i < list.Count; i++) { back = list[i] as IntervalCallBack; if (back != null) { new Thread(new ThreadStart(back.Invoke)).Start(); } } }