Exemplo n.º 1
0
        public void Delete()
        {
            if (SelectedStep == null)
            {
                return;
            }
            var diagle = windowManager.ShowMessageBox(String.Format("确定要删除"), "系统提示", MessageBoxButton.YesNo);

            if (diagle == MessageBoxResult.Yes)
            {
                List <T_LogicStep> selsteps = new List <T_LogicStep>(SelectedStep.ToArray());
                foreach (var selstep in selsteps)
                {
                    if (this.logicService.DeleteT_LogicStep(selstep.ID))
                    {
                        var CurrentIndex = StepList.IndexOf(selstep);
                        for (int i = CurrentIndex; i < StepList.Count; i++)
                        {
                            StepList[i].OrderIndex = StepList[i].OrderIndex - 1;
                        }
                        StepList.Remove(selstep);
                        Program.LogicSteps = StepList.ToList();
                        SaveEvent?.Invoke(Program);
                    }
                    else
                    {
                        this.View.ShowHint(new MessageWin(false));
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void ShowProcessFlowSummary(Step lastProcessFlowStep)
        {
            List <StepAnswer> stepAnswersList = new List <StepAnswer>();

            if (lastProcessFlowStep != null)
            {
                StepList.Add(lastProcessFlowStep);
            }

            // loop throuch each of the steps and display the question and answers depending on the Step Type (Button, Text, Numeric, Date)
            foreach (var step in StepList)
            {
                var stepIndex = StepList.IndexOf(step);

                //skip the first step since it is the root step
                if (stepIndex > 0)
                {
                    //get the step interacted with before the current one
                    var stepBefore = StepList[stepIndex - 1];

                    // if the step before the current one is of type button then the NavigationText attribute is the answer to the prior step
                    if (stepBefore.Type == (int)StepInputTypeEnum.Options)
                    {
                        //Logger.Verbose(stepBefore.HeaderText + " : " + step.NavigationText);
                        //Logger.Verbose("");
                        stepAnswersList.Add(new StepAnswer {
                            AnswerValue = step.NavigationText, QuestionValue = stepBefore.HeaderText
                        });
                    }
                    else
                    {
                        // else if the step before the current one is of type text/numeric/date then get the answer from the dictionary
                        string stepAnwer = "";
                        if (StepAnswersDictionary.TryGetValue(stepBefore.Id, out stepAnwer))
                        {
                            Logger.Verbose(stepBefore.HeaderText + " : " + stepAnwer);
                            //Logger.Verbose("");
                            stepAnswersList.Add(new StepAnswer {
                                AnswerValue = stepAnwer, DataKey = stepBefore.DataKey, QuestionValue = stepBefore.HeaderText
                            });
                        }
                    }
                }
            }

            //set the serialiazed string of step answers
            StepAnswerListStringDefinition = JsonConvert.SerializeObject(stepAnswersList);

            //set the OutcomeId of the last step (with an Endpoint)
            if (lastProcessFlowStep != null)
            {
                OutComeIdString = lastProcessFlowStep.Outcome.ToString();
            }

            //display the process flow summary
            ReplaceFragment(ProcessFlowSummaryFragmentInstance, Resource.Id.ticket_placeholder, SummaryFragmentTag);
        }
Exemplo n.º 3
0
        public void MoveUp()
        {
            if (SelectedStep == null)
            {
                return;
            }
            List <T_LogicStep> selsteps = new List <T_LogicStep>(SelectedStep.ToArray());

            foreach (var selstep in selsteps)
            {
                var CurrentIndex = StepList.IndexOf(selstep);
                if (CurrentIndex == 0)
                {
                    return;
                }
                var sec = StepList[CurrentIndex - 1];
                sec.OrderIndex     = sec.OrderIndex + 1;
                selstep.OrderIndex = selstep.OrderIndex - 1;
                StepList.Remove(sec);
                StepList.Insert(CurrentIndex, sec);
            }
        }