Example #1
0
        public Step Clone()
        {
            var step = new Step { Name = Name, Screen = Screen, Controller = Controller };

            foreach (var action in Actions)
                step.Actions.Add(action.Key, action.Value);

            foreach (var action in RegisteredActions)
                step.RegisteredActions.Add(action);

            if (Parameters != null)
                foreach (var parameter in Parameters)
                    step.Parameters.Add(parameter.Key, parameter.Value);

            return step;
        }
Example #2
0
 void ClearState()
 {
     _history.Clear();
     _currentStep = null;
 }
Example #3
0
        void OpenScreen(IApplicationContext ctx, Step step, Dictionary<String, object> parameters = null, bool isBackCommand = false)
        {
            step.Parameters = parameters;
            if (_currentStep != step)
            {
                step.Init();
                _history.Push(step);
                _currentStep = step;
            }

            string controller = String.IsNullOrEmpty(step.Controller) ? Controller : step.Controller;
            ctx.OpenScreen(step.Screen, controller, step.Parameters, isBackCommand);
        }
Example #4
0
        void DoForward(IApplicationContext ctx, Step step, Dictionary<String, object> parameters = null, bool isBackCommand = false)
        {
            string lastStep = _currentStep != null ? _currentStep.Name : "null";
            object allowed = InvokeCallback(ctx, WORKFLOW_FORWARDING_EVENT
                  , lastStep
                  , step != null ? step.Name : "null"
                  , parameters);

            if (allowed != null && !(allowed is bool))
                throw new JSException(string.Format(
                    "Function {0} returned incorrect value: {1}", WORKFLOW_FORWARDING_EVENT, allowed));

            if (allowed == null || (bool)allowed)
            {
                OpenScreen(ctx, step, parameters, isBackCommand);

                InvokeCallback(ctx, WORKFLOW_FORWARD_EVENT
                    , lastStep
                    , step != null ? step.Name : "null"
                    , parameters);
            }
        }
Example #5
0
 public void AddChild(object obj)
 {
     Step step = (Step)obj;
     if (_firstStep == null)
         _firstStep = step;
     _steps.Add(step.Name, step);
 }