private void OnRequestCompleted(MultipleDataResponse mdr) { if (isDisposed) return; List<ReplicationTarget> entries = CaptureEntries(); DataResponse[] responses = mdr; foreach (var re in entries) { foreach (var id in re.GetSourceIDs()) { foreach (var resp in responses.Where(r => r.DataRequest.Variable.ID == id)) re.ApplyDataChanges(id, resp); foreach (var changes in changesToApply.Where(c => c.ID == id && c.MetadataChanges != null)) re.ApplyMetadataChanges(id, changes.MetadataChanges); } } activeRequests.Clear(); changesToApply.Clear(); CommitTargets(entries); // Process enqueued commits from proxy int commitCount = 0; lock (commits) commitCount = commits.Count; if (commitCount > 0 && !syncEnqueued) wpfDispatcher.BeginInvoke(Priority, new SyncHandler(Sync)); // Start next requests if any if (pendingRequests.Count > 0) BeginDataRequest(); }
/// <summary> /// Creates an instance in case of success. /// </summary> /// <param name="response"></param> public AsyncMultipleDataResponse(MultipleDataResponse response) { this.response = response; }