B2017-179 detect if Paste/Replace was aborted due to Transition references and user had selected to go to the first transition that needs attention.

This commit is contained in:
John Jenko 2017-09-01 12:41:07 +00:00
parent d228ca58dc
commit 34ea55a624
2 changed files with 12 additions and 4 deletions

View File

@ -1823,7 +1823,7 @@ namespace Volian.Controls.Library
{
// To allow a Paste Step into an empty (new) step/substep, we need to add a character to the the Text field
// to simulate replacing an existing step - otherwise we will get null references.
if (MyStepPanel.SelectedEditItem.Empty)
if (MyStepPanel.SelectedEditItem != null && MyStepPanel.SelectedEditItem.Empty)
MyStepPanel.SelectedEditItem.Empty = false;
MyStepPanel.SelectedEditItem = null; // Unselect the item to be deleted
ChildRelation childRelation = _MyChildRelation;
@ -1837,9 +1837,17 @@ namespace Volian.Controls.Library
int? TopMostParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.TopMostEditItem.Top));
int? ParentY = (MyParentEditItem == null ? null : (int?)(MyParentEditItem.Top));
ItemInfo newItemInfo = null;
bool gotoFirstTrans = false;
try
{
newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID, GetChangeId(MyItemInfo));
newItemInfo = Item.PasteReplace(MyItemInfo, copyStartID, GetChangeId(MyItemInfo), ref gotoFirstTrans);
if (gotoFirstTrans) //B2017-179 could not replace step, we are positioning onto the first transition that needs resolved
{
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(newItemInfo);
return null;
}
if (newItemInfo == null)
return this; // aborted the replace so just return to the step we were trying to replace
}
//catch (System.Data.SqlClient.SqlException ex)
catch (Exception ex)
@ -1850,7 +1858,6 @@ namespace Volian.Controls.Library
}
// Remove the EditItem that was the replaced item.
RemoveFromParentsChildList();
if (MyNextEditItem != null)
{
if (MyPreviousEditItem != null)

View File

@ -3569,7 +3569,8 @@ namespace Volian.Controls.Library
if (tmp.MyDisplayTabControl.MyCopyStep == null) return;
EditItem oldEditItem = MyEditItem;
MyEditItem = MyEditItem.PasteReplace(tmp.MyDisplayTabControl.MyCopyStep.ItemID);
if (MyEditItem.MyItemInfo.ItemID != oldEditItem.MyItemInfo.ItemID) oldEditItem.Dispose();
if (MyEditItem == null) oldEditItem.IdentifyMe(false); // B2017-179 if null then we didn't do the replace but did position to the first transition that needs resolved
if (MyEditItem != null && MyEditItem.MyItemInfo.ItemID != oldEditItem.MyItemInfo.ItemID) oldEditItem.Dispose();
}
private void btnPdfCreate_Click(object sender, EventArgs e)