B2020-097 and B2020-098: In Step editor, Deleting of sections with transition to section

This commit is contained in:
Kathy Ruffing 2020-07-28 12:48:49 +00:00
parent ae93427f2b
commit daa87765d1
2 changed files with 28 additions and 5 deletions

View File

@ -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))

View File

@ -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;
}