Beispiel #1
0
        public async Task <IActionResult> Resume(string id, string elt, [FromBody] ResumeCommand resumeCommand, CancellationToken token)
        {
            try
            {
                resumeCommand.CasePlanInstanceId        = id;
                resumeCommand.CasePlanInstanceElementId = elt;
                await _mediator.Send(resumeCommand, token);

                return(new OkResult());
            }
            catch (UnknownCasePlanInstanceException)
            {
                return(this.ToError(new Dictionary <string, string>
                {
                    { "bad_request", "case instance doesn't exist" }
                }, HttpStatusCode.NotFound, Request));
            }
            catch (AggregateValidationException ex)
            {
                return(this.ToError(ex.Errors, HttpStatusCode.BadRequest, Request));
            }
            catch (Exception ex)
            {
                return(this.ToError(new Dictionary <string, string>
                {
                    { "invalid_request", ex.Message }
                }, HttpStatusCode.BadRequest, Request));
            }
        }
        /// <summary>
        ///     Resume().
        /// </summary>
        /// <returns></returns>
        public async Task <bool> Resume()
        {
            var command = new ResumeCommand();
            var reply   = await Send(command);

            return(reply != null && reply.IsSuccessful);
        }
Beispiel #3
0
 private void RaisePauseChanged()
 {
     IsPaused = CancellationTokenSource?.IsPaused ?? false;
     RaisePropertiesChanged(() => CanPause, () => CanResume);
     PauseCommand.RaiseCanExecuteChanged();
     ResumeCommand.RaiseCanExecuteChanged();
     CancelCurrentOperationCommand.RaiseCanExecuteChanged();
 }
Beispiel #4
0
 private void RaiseCanExecute()
 {
     StartCommand.RaiseCanExecuteChanged();
     RestoreCommand.RaiseCanExecuteChanged();
     StopCommand.RaiseCanExecuteChanged();
     SuspendCommand.RaiseCanExecuteChanged();
     ResumeCommand.RaiseCanExecuteChanged();
 }
Beispiel #5
0
 private void RaisePlayerStatusChanged()
 {
     MoveNextCommand.RaiseCanExecuteChanged();
     MovePreviousCommand.RaiseCanExecuteChanged();
     PauseCommand.RaiseCanExecuteChanged();
     ResumeCommand.RaiseCanExecuteChanged();
     SkipToPercentageCommand.RaiseCanExecuteChanged();
     RaisePropertyChanged(nameof(Playing));
 }
Beispiel #6
0
		private async Task Redirect(string server)
		{
			await DisconnectInternal(isUnexpected: false).ConfigureAwait(false);
			await Connect().ConfigureAwait(false);

			var resumeMsg = new ResumeCommand();
			resumeMsg.Payload.SessionId = _sessionId;
			resumeMsg.Payload.Sequence = _lastSeq;
			QueueMessage(resumeMsg);
		}
        private async Task Redirect(string server)
        {
            await DisconnectInternal(isUnexpected : false).ConfigureAwait(false);

            await BeginConnect().ConfigureAwait(false);
            await Start().ConfigureAwait(false);

            var resumeMsg = new ResumeCommand();

            resumeMsg.Payload.SessionId = _sessionId;
            resumeMsg.Payload.Sequence  = _lastSeq;
            QueueMessage(resumeMsg);
        }
Beispiel #8
0
        public string CanResume()
        {
            if (isTouchReported)
            {
                var tmp = new ResumeCommand();
                JsonSerializerSettings settings = new JsonSerializerSettings {
                    TypeNameHandling = TypeNameHandling.Auto
                };
                string serialized = JsonConvert.SerializeObject(tmp, settings);

                isTouchReported = !isTouchReported;

                return(serialized);
            }
            else
            {
                return(string.Empty);
            }
        }
Beispiel #9
0
        private Task <ICommandResponse <ResumeCommand> > ResumeCommand(ResumeCommand arg)
        {
            Continue();

            return(Task.FromResult <ICommandResponse <ResumeCommand> >(new ResumeCommandResponse()));
        }
            public Task PublishExternalEvt(string evt, string casePlanInstanceId, string casePlanElementInstanceId, Dictionary <string, string> parameters, CancellationToken token)
            {
                IBaseRequest request = null;

                switch (evt)
                {
                case CMMNConstants.ExternalTransitionNames.AddChild:
                    request = new AddChildCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Close:
                    request = new CloseCommand(casePlanInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Complete:
                    request = new CompleteCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Disable:
                    request = new DisableCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Occur:
                    request = new OccurCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Reactivate:
                    request = new ReactivateCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Reenable:
                    request = new ReenableCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Resume:
                    request = new ResumeCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Suspend:
                    request = new SuspendCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.Terminate:
                    request = new TerminateCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;

                case CMMNConstants.ExternalTransitionNames.ManualStart:
                    request = new ActivateCommand(casePlanInstanceId, casePlanElementInstanceId)
                    {
                        Parameters = parameters
                    };
                    break;
                }

                return(_mediator.Send(request, token));
            }
Beispiel #11
0
 public void OnResumeCommand(ResumeCommand cmd)
 {
     Model.GameStatus = GameStatus.Gaming;
 }