Example #1
0
        public IContextualResourceModel SaveAWorkflow(string workflowName)
        {
            Get <List <IDebugState> >("debugStates").Clear();
            BuildShapeAndTestData();

            var activityList = _commonSteps.GetActivityList();

            var flowSteps = new List <FlowStep>();

            TestStartNode = new FlowStep();
            flowSteps.Add(TestStartNode);
            if (activityList != null)
            {
                foreach (var activity in activityList)
                {
                    if (TestStartNode.Action == null)
                    {
                        TestStartNode.Action = activity.Value;
                    }
                    else
                    {
                        var flowStep = new FlowStep {
                            Action = activity.Value
                        };
                        flowSteps.Last().Next = flowStep;
                        flowSteps.Add(flowStep);
                    }
                }
            }
            TryGetValue("resourceModel", out IContextualResourceModel resourceModel);
            TryGetValue("server", out IServer server);
            TryGetValue("resourceRepo", out IResourceRepository repository);

            var currentDl = CurrentDl;

            resourceModel.DataList = currentDl.Replace("root", "DataList");
            var helper         = new WorkflowHelper();
            var xamlDefinition = helper.GetXamlDefinition(FlowchartActivityBuilder);

            resourceModel.WorkflowXaml = xamlDefinition;
            repository.Save(resourceModel);
            repository.SaveToServer(resourceModel);

            return(resourceModel);
        }