예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Microsoft.Research.Science.Data.Utilities.DataSetReplicator"/> class.
        /// </summary>
        /// <param name="source">Source.</param>
        /// <param name="wpfDispatcher">Wpf dispatcher.</param>
        public DataSetReplicator(DataSet source, WPFDispatcher wpfDispatcher)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (wpfDispatcher == null)
            {
                throw new ArgumentNullException("wpfDispatcher");
            }

            this.source        = source;
            this.wpfDispatcher = wpfDispatcher;

            DataSetCommittedEventManager.AddListener(source, this);
        }
예제 #2
0
        public void Dispose()
        {
            isDisposed = true;
            DataSetCommittedEventManager.RemoveListener(source, this);
            source = null;
            lock (commits)
            {
                commits.Clear();
                activeRequests.Clear();
                pendingRequests.Clear();
                entireDataRequests.Clear();
            }

            foreach (var r in replicas)
            {
                DataSet target = r.Target;
                if (target != null)
                {
                    target.Dispose();
                }
            }
        }