Beispiel #1
0
        /// <summary>
        /// 执行流程结束事件
        /// </summary>
        /// <param name="@event">结束事件对象</param>
        internal static void Execute(this EndEvent @event)
        {
            if (@event.IsAllowToSend)
            {
                // 流程完成
                var process = @event.ProcessRef;
                process.ExecuteNote.OnNext(new ExecutorEventArgs
                {
                    Type    = "EndEvent",
                    Id      = @event.Id,
                    Name    = @event.Name,
                    Message = "进程结束!"
                });
                process.Dispose();
            }
            else
            {
                // 未完成使命,等待通知
                if (@event.ChangeNote == null)
                {
                    @event.ChangeNote = new Subject <bool>();

                    @event.ChangeNote.Subscribe(observer =>
                    {
                        @event.ProcessRef.ExecuteNote.OnNext(new ExecutorEventArgs
                        {
                            Type    = "EndEvent",
                            Id      = @event.Id,
                            Name    = @event.Name,
                            Message = "结束事件运行中!"
                        });
                        @event.Execute();
                    });
                }
            }
        }