Esempio n. 1
0
        private void ThrowEvent(ExecutionContext context,
                                ILogger logger,
                                IEventThrower eventThrower)
        {
            _history.Add(HistoryItem.Create(context.Token, HistoryItemActions.EventThrown));

            eventThrower.Throw(context.WithRunningElement(eventThrower));
            logger?.LogInformation($"Event {context.Token.ExecutionPoint} was thrown.");

            if (context.Model.IsEndEventThrower(context.Token.ExecutionPoint))
            {
                context.Token.ExecutionPoint = null;
                context.Token.Release();
                IsDone = true;
            }
            else
            {
                var connections = context.Model.GetOutcomingConnections(
                    context.Token.ExecutionPoint
                    ).ToArray();

                // TODO: Move this to the model validation
                if (connections.Length != 1)
                {
                    throw new NotSupportedException();
                }

                context.Token.ExecutionPoint = connections.FirstOrDefault()?.Element.To;
                MoveOn(context, logger);
            }
        }
Esempio n. 2
0
 public ProcessModel AddEventThrower(string name, IEventThrower thrower)
 => AddEventThrower(NamedProcessElement <IEventThrower> .Create(name, thrower));