B2017-222: Don’t create enhanced links for paste replaced steps

This commit is contained in:
2017-09-26 14:33:42 +00:00
parent fbedffd01d
commit 54f1be3ba1
2 changed files with 20 additions and 6 deletions

View File

@@ -1821,6 +1821,7 @@ namespace Volian.Controls.Library
}
public EditItem PasteReplace(int copyStartID)
{
if (this is RTBItem) (this as RTBItem).DoingPasteReplace = true;
// 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 != null && MyStepPanel.SelectedEditItem.Empty)
@@ -1844,16 +1845,21 @@ namespace Volian.Controls.Library
if (gotoFirstTrans) //B2017-179 could not replace step, we are positioning onto the first transition that needs resolved
{
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(newItemInfo);
if (this is RTBItem) (this as RTBItem).DoingPasteReplace = true;
return null;
}
if (newItemInfo == null)
{
if (this is RTBItem) (this as RTBItem).DoingPasteReplace = true;
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)
{
if (HandleSqlExceptionOnCopy(ex)) return this;
HandleSqlExceptionOnDelete(ex);
if (this is RTBItem) (this as RTBItem).DoingPasteReplace = true;
return this;
}
// Remove the EditItem that was the replaced item.
@@ -1906,9 +1912,7 @@ namespace Volian.Controls.Library
}
MyStepPanel.SelectedEditItem = newEditItem; //Update Screen
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.Replace, newItemInfo.MyContent.Type));
// MyItemInfo is the 'paste from' item, if it has enhanced need to copy and paste the steps in enhanced.
ItemInfo newEnh = newItemInfo.PasteEnhancedItems(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.Replace, GetChangeId(MyItemInfo));
if (newEnh != null) AddAllEnhancedItemsToDisplay(newItemInfo); // KBR - I think this won't work for replace!!
if (this is RTBItem) (this as RTBItem).DoingPasteReplace = true;
return newEditItem;
}
private bool HandleSqlExceptionOnCopy(Exception ex)