public static Task <IDicomClientState> TransitionToCompletedState(this DicomClient dicomClient, IDicomClientConnection connection, DicomClientCancellation cancellation) { var completedParameters = new DicomClientCompletedState.DicomClientCompletedWithoutErrorInitialisationParameters(connection); var completedState = new DicomClientCompletedState(dicomClient, completedParameters); return(dicomClient.Transition(completedState, cancellation)); }
public static Task <IDicomClientState> TransitionToAbortState(this DicomClient dicomClient, IInitialisationWithConnectionParameters parameters, DicomClientCancellation cancellation) { var abortParameters = new DicomClientAbortState.InitialisationParameters(parameters.Connection); var abortState = new DicomClientAbortState(dicomClient, abortParameters); return(dicomClient.Transition(abortState, cancellation)); }
public static Task <IDicomClientState> TransitionToRequestAssociationState(this DicomClient dicomClient, IDicomClientConnection connection, DicomClientCancellation cancellation) { var requestAssociationParameters = new DicomClientRequestAssociationState.InitialisationParameters(connection); var requestAssociationState = new DicomClientRequestAssociationState(dicomClient, requestAssociationParameters); return(dicomClient.Transition(requestAssociationState, cancellation)); }
public static Task <IDicomClientState> TransitionToCompletedState(this DicomClient dicomClient, IInitialisationWithConnectionParameters parameters, DicomClientCancellation cancellation) { return(TransitionToCompletedState(dicomClient, parameters.Connection, cancellation)); }
public static Task <IDicomClientState> TransitionToReleaseAssociationState(this DicomClient dicomClient, IInitialisationWithAssociationParameters parameters, DicomClientCancellation cancellation) { var releaseAssociationParameters = new DicomClientReleaseAssociationState.InitialisationParameters(parameters.Association, parameters.Connection); var releaseAssociationState = new DicomClientReleaseAssociationState(dicomClient, releaseAssociationParameters); return(dicomClient.Transition(releaseAssociationState, cancellation)); }
public static Task <IDicomClientState> TransitionToLingerState(this DicomClient dicomClient, IInitialisationWithAssociationParameters parameters, DicomClientCancellation cancellation) { var lingerParameters = new DicomClientLingeringState.InitialisationParameters(parameters.Association, parameters.Connection); var lingerState = new DicomClientLingeringState(dicomClient, lingerParameters); return(dicomClient.Transition(lingerState, cancellation)); }
public static Task <IDicomClientState> TransitionToSendingRequestsState(this DicomClient dicomClient, IInitialisationWithConnectionParameters parameters, DicomAssociation association, DicomClientCancellation cancellation) { var sendingRequestsParameters = new DicomClientSendingRequestsState.InitialisationParameters(association, parameters.Connection); var sendingRequestsState = new DicomClientSendingRequestsState(dicomClient, sendingRequestsParameters); return(dicomClient.Transition(sendingRequestsState, cancellation)); }
public static Task <IDicomClientState> TransitionToSendingRequestsState(this DicomClient dicomClient, IInitialisationWithAssociationParameters parameters, DicomClientCancellation cancellation) { return(TransitionToSendingRequestsState(dicomClient, parameters, parameters.Association, cancellation)); }
public static Task <IDicomClientState> TransitionToConnectState(this DicomClient dicomClient, DicomClientCancellation cancellation) { var connectState = new DicomClientConnectState(dicomClient); return(dicomClient.Transition(connectState, cancellation)); }
public static Task <IDicomClientState> TransitionToIdleState(this DicomClient dicomClient, DicomClientCancellation cancellation) { var idleState = new DicomClientIdleState(dicomClient); return(dicomClient.Transition(idleState, cancellation)); }
public static Task <IDicomClientState> TransitionToCompletedWithErrorState(this DicomClient dicomClient, IDicomClientConnection connection, Exception exception, DicomClientCancellation cancellation) { var completedWithErrorParameters = connection == null ? new DicomClientCompletedState.DicomClientCompletedWithErrorInitialisationParameters(exception) : new DicomClientCompletedState.DicomClientCompletedWithErrorInitialisationParameters(exception, connection); var completedWithErrorState = new DicomClientCompletedState(dicomClient, completedWithErrorParameters); return(dicomClient.Transition(completedWithErrorState, cancellation)); }
public async Task SendAsync(CancellationToken cancellationToken = default(CancellationToken), DicomClientCancellationMode cancellationMode = DicomClientCancellationMode.ImmediatelyReleaseAssociation) { var cancellation = new DicomClientCancellation(cancellationToken, cancellationMode); await State.SendAsync(cancellation).ConfigureAwait(false); }
internal async Task <IDicomClientState> Transition(IDicomClientState newState, DicomClientCancellation cancellation) { Task InternalTransition() { var oldState = State; Logger.Debug($"[{oldState}] --> [{newState}]"); oldState.Dispose(); State = newState ?? throw new ArgumentNullException(nameof(newState)); StateChanged?.Invoke(this, new StateChangedEventArgs(oldState, newState)); return(CompletedTaskProvider.CompletedTask); } await ExecuteWithinTransitionLock(InternalTransition).ConfigureAwait(false); return(await newState.GetNextStateAsync(cancellation).ConfigureAwait(false)); }