/// <summary> /// Cleans up any weakly held references. /// </summary> public void CleanupUnheldProxies() { // Invoke the weakly held proxies: for (int i = this.proxies.Count - 1; i >= 0; i--) { ObservableCommandProxy proxy = null; WeakReference <ObservableCommandProxy> weakReference = this.proxies[i]; if (!weakReference.TryGetTarget(out proxy)) { this.proxies.RemoveAt(i); } } }
/// <summary> /// Registers a proxy with the command. /// </summary> public void RegisterProxy(ObservableCommandProxy proxy, EventHandler handler) { this.proxies.Add(new WeakReference <ObservableCommandProxy>(proxy)); this.proxyHandlers.Add(proxy, handler); }
/// <summary> /// Registers a proxy with the command. /// </summary> public void RegisterProxy(ObservableCommandProxy proxy, EventHandler handler) { this.proxies.Add(new WeakReference<ObservableCommandProxy>(proxy)); this.proxyHandlers.Add(proxy, handler); }