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)); } } } }
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); } }
public void DeleteStep(StepViewModel viewModel) { scene.steps.Remove(viewModel.step); StepList.Remove(viewModel); window.DataGrid_RowChanged(); }
public async void ShowStep(Step processFlowStep) { //either display the step or remove it from the persisted step list if (processFlowStep != null) { var stepToAddRemove = processFlowStep; if (StepList.Contains(stepToAddRemove)) { //text/numeric/date input answers to be removed from state if (stepToAddRemove.Type != (int)StepInputTypeEnum.Options) { //remove the saved answer from persisted state StepAnswersDictionary.Remove(stepToAddRemove.Id); } //if it already exists in the persisted step list, remove it StepList.Remove(stepToAddRemove); if (StepList.Any()) { //and get the step before it stepToAddRemove = StepList.Last(); } else { //if after removing and there are no more steps, go back to the previous activity base.OnBackPressed(); } } else { //if it doesnt exist in the persisted step list, add it StepList.Add(stepToAddRemove); } //instantiate a new Step Fragment var processFlowFragment = new ProcessFlowFragment(); Bundle args = new Bundle(); //serialize the object to a step definition string var processFlowString = JsonConvert.SerializeObject(stepToAddRemove); //pass the step string definition to the fragment in the bundle args.PutString(ProcessFlowStep, processFlowString); // if the step to be shown is a text/numeric/date input, check the dictionary for a saved answer entered previously and pass it to the fragment if (stepToAddRemove.Type != (int)StepInputTypeEnum.Options) { string stepAnwer = null; if (StepAnswersDictionary.TryGetValue(stepToAddRemove.Id, out stepAnwer)) { Logger.Verbose(stepToAddRemove.HeaderText + " : Answer found in Dictionary to be shown in Fragment : " + stepAnwer); } args.PutString(ProcessFlowStepAnswer, stepAnwer); } processFlowFragment.Arguments = args; //display the fragment ReplaceFragment(processFlowFragment, Resource.Id.ticket_placeholder, TicketFragmentTag); } }