コード例 #1
0
        /// <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);
                }
            }
        }
コード例 #2
0
 /// <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);
 }
コード例 #3
0
 /// <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);
 }