Example #1
0
        public void InvokeAction(IApplicationContext ctx
                                 , String name
                                 , Dictionary <String, object> parameters
                                 , bool isBackCommand = false)
        {
            try
            {
                if (_currentStep != null)
                {
                    _currentStep.SaveControlsState(ctx.ValueStack.Persistables);
                }

                if (this._currentStep.Actions.ContainsKey(name))
                {
                    Action a = this._currentStep.Actions[name];

                    if (!String.IsNullOrEmpty(a.NextStep))
                    {
                        DoForward(ctx, this._steps[a.NextStep], parameters, isBackCommand);
                        return;
                    }

                    if (!String.IsNullOrEmpty(a.NextWorkflow))
                    {
                        InvokeCallback(ctx, WORKFLOW_PAUSE_EVENT);
                        BusinessProcess.Start(ctx, a.NextWorkflow);
                        return;
                    }

                    BusinessProcess.TerminateWorkflow(ctx, this, false);

                    return;
                }

                if (_globalActions.Contains(name))
                {
                    switch (name)
                    {
                    case "Back":
                        DoBack(ctx);
                        break;

                    case "BackTo":
                        DoBack(ctx, parameters["step"].ToString());
                        break;

                    case "Commit":
                        DoCommit(ctx);
                        break;

                    case "Rollback":
                        DoRollback(ctx);
                        break;
                    }

                    return;
                }

                ActionHandlerEx.Busy = false;
                ActionHandler.Busy   = false;
            }
            catch (Exception e)
            {
                ctx.ValueStack.ExceptionHandler.Handle(e);
            }
        }