public bool Remove(IViewModelReceiver receiver) { bool removed = false; IViewModelReceiver item; for (int i = mReceivers.Count - 1; i > -1; --i) { if (mReceivers[i].TryGetTarget(out item) && ReferenceEquals(item, receiver)) { mReceivers.RemoveAt(i); removed = true; } } return(removed); }
public void Add(IViewModelReceiver receiver) { mReceivers.Add(new WeakReference <IViewModelReceiver>(receiver)); }