/// <summary> /// Called when received response message. /// </summary> /// <param name="client">The client.</param> /// <param name="association">The association.</param> /// <param name="presentationID">The presentation ID.</param> /// <param name="message">The message.</param> public override void OnReceiveResponseMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message) { // Discovered issue with an SCP that was not setting these values on the final Success return, so blocking an update of the values if all of them are 0. if (message.NumberOfFailedSubOperations != 0 || message.NumberOfCompletedSubOperations != 0 || message.NumberOfRemainingSubOperations != 0 || message.NumberOfWarningSubOperations != 0) { _failureSubOperations = message.NumberOfFailedSubOperations; _successSubOperations = message.NumberOfCompletedSubOperations; _remainingSubOperations = message.NumberOfRemainingSubOperations; _warningSubOperations = message.NumberOfWarningSubOperations; _totalSubOperations = _failureSubOperations + _successSubOperations + _remainingSubOperations + _warningSubOperations; } if (!string.IsNullOrEmpty(message.ErrorComment)) { FailureDescription = message.ErrorComment; } if (message.Status.Status == DicomState.Pending) { OnImageMoveCompleted(); } else { DicomStatus status = DicomStatuses.LookupQueryRetrieve(message.Status.Code); if (message.Status.Status != DicomState.Success) { if (status.Status == DicomState.Cancel) { if (LogInformation) { Platform.Log(LogLevel.Info, "Cancel status received in Move Scu: {0}", status); } Status = ScuOperationStatus.Canceled; } else if (status.Status == DicomState.Failure) { Platform.Log(LogLevel.Error, "Failure status received in Move Scu: {0}", status); Status = ScuOperationStatus.Failed; FailureDescription = status.ToString(); } else if (status.Status == DicomState.Warning) { Platform.Log(LogLevel.Warn, "Warning status received in Move Scu: {0}", status); } else if (Status == ScuOperationStatus.Canceled) { if (LogInformation) { Platform.Log(LogLevel.Info, "Client cancelled Move Scu operation."); } } } else { if (LogInformation) { Platform.Log(LogLevel.Info, "Success status received in Move Scu!"); } } client.SendReleaseRequest(); StopRunningOperation(); } }
/// <summary> /// Called when received response message. Sets the <see cref="Results"/> property as appropriate. /// </summary> /// <param name="client">The client.</param> /// <param name="association">The association.</param> /// <param name="presentationID">The presentation ID.</param> /// <param name="message">The message.</param> public override void OnReceiveResponseMessage(DicomClient client, ClientAssociationParameters association, byte presentationID, DicomMessage message) { if (message.Status.Status == DicomState.Pending) { // one result sent back, add to result list _results.Add(message.DataSet); if (_maxResults != -1 && !_cancelSent && _results.Count > _maxResults) { client.SendCFindCancelRequest(presentationID, message.MessageIdBeingRespondedTo); _cancelSent = true; } } else { _cancelSent = false; DicomStatus status = DicomStatuses.LookupQueryRetrieve(message.Status.Code); if (status.Status != DicomState.Success) { if (status.Status == DicomState.Cancel) { if (LogInformation) { Platform.Log(LogLevel.Info, "Cancel status received in Find Scu: {0}", status); } Status = ScuOperationStatus.Canceled; } else if (status.Status == DicomState.Failure) { Platform.Log(LogLevel.Error, "Failure status received in Find Scu: {0}", status); Status = ScuOperationStatus.Failed; FailureDescription = status.ToString(); } else if (status.Status == DicomState.Warning) { Platform.Log(LogLevel.Warn, "Warning status received in Find Scu: {0}", status); } else if (Status == ScuOperationStatus.Canceled) { if (LogInformation) { Platform.Log(LogLevel.Info, "Client cancelled Find Scu operation."); } } } else { if (LogInformation) { Platform.Log(LogLevel.Info, "Success status received in Find Scu!"); } } if (!ReuseAssociation) { client.SendReleaseRequest(); StopRunningOperation(); } else { ProgressEvent.Set(); } } }