From daa87765d1a25276bcbdd91e83c26d9db1540555 Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 28 Jul 2020 12:48:49 +0000 Subject: [PATCH] B2020-097 and B2020-098: In Step editor, Deleting of sections with transition to section --- PROMS/Volian.Controls.Library/EditItem.cs | 28 +++++++++++++++++++ .../Volian.Controls.Library/StepTabRibbon.cs | 5 ---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs index 2e16c3e8..c4b1c2ce 100644 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ b/PROMS/Volian.Controls.Library/EditItem.cs @@ -1081,6 +1081,34 @@ namespace Volian.Controls.Library SetFocus(); } } + // B2020-097: If deleting a section that has transitions pointing to it, show list: + // B2020-098: If deleting a section that has transitions & select to remove 1st transition, crash on trying to delete section again + else if (ex.Message.Contains("has External Transitions to Section")) + { + using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(MyID)) + { + DialogResult ans = FlexibleMessageBox.Show("Transitions exist to this section and cannot be adjusted automatically." + + "\r\n\r\nDo you want to be placed at the " + (exTrans.Count > 1 ? "first " : "") + "location with the problem Transition?" + + "\r\n\r\nLocations with Problem Transitions" + + exTrans.Summarize(), + "Cannot Delete This Section", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + if (ans == DialogResult.Yes) + { + if (MyStepRTB.Text == "") + { + this.MyStepRTB.InsertSymbol(@"\u160?"); // since text was deleted, insert a hard space to prevent a looping effect B2016-082 + using (Item itm = MyStepRTB.MyItemInfo.Get()) + { + Annotation x = Annotation.MakeAnnotation(itm, AnnotationType.GetByName("Verification Required"), null, "A Hard Space was put in to keep the Transitions referencing here valid. \nPlease remove or re-assign these transitions before deleting this step.", null); + } + } + MyStepPanel.SelectedEditItem = this; + MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(exTrans[0].MyContent.ContentItems[0]); + } + else + MyStepPanel.SelectedEditItem = this; + } + } else if (ex.Message.Contains("has External Transitions to it's children")) { using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(MyID)) diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index 0816f017..22fbc8b0 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -3367,11 +3367,6 @@ namespace Volian.Controls.Library MyEditItem.MyStepPanel.OnWordSectionClose(sender, args); } MyEditItem.RemoveItem(); - if (!si.IsStepSection) - { - WordSectionEventArgs args = new WordSectionEventArgs(si); - MyEditItem.MyStepPanel.OnWordSectionDeleted(sender, args); - } } return; }