C2024-004 Fixed issue related to replacing enhanced procs, double replace would attempt to happen, this prevents that and should allow for enhanced replacements also

This commit is contained in:
Kevin Laskey 2024-07-08 10:20:32 -04:00
parent 616acf0e37
commit f6f7d6a8c7
2 changed files with 12 additions and 6 deletions

View File

@ -669,7 +669,7 @@ namespace Volian.Controls.Library
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
string key = "Item - " + proc.ItemID.ToString();
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
if (_MyDisplayTabItems.ContainsKey(key) && pasteType != ItemInfo.EAddpingPart.Replace) // If procedure page open use it unless replace
{
DisplayTabItem pg = _MyDisplayTabItems[key];
if (pg.MyStepTabPanel.MyStepPanel._LookupEditItems.ContainsKey(myItemInfo.ItemID) &&
@ -688,14 +688,14 @@ namespace Volian.Controls.Library
edtitm.PasteSiblingAfter(copyStartID);
break;
case ItemInfo.EAddpingPart.Replace:
EditItem ei = edtitm.PasteReplace(copyStartID);
if (ei == null)
{
{
CloseTabItem(_MyDisplayTabItems["Item - " + myItemInfo.ItemID.ToString()]); //Grab itemID and set to close open tab.
return false; //B2017-179 PasteReplace will return null if was aborted
}
if (ei.MyItemInfo.ItemID != edtitm.MyItemInfo.ItemID)
{
edtitm.Dispose();
@ -708,6 +708,12 @@ namespace Volian.Controls.Library
return true;
}
}
else if (_MyDisplayTabItems.ContainsKey(key) && pasteType == ItemInfo.EAddpingPart.Replace)
{
CloseTabItem(_MyDisplayTabItems["Item - " + myItemInfo.ItemID.ToString()]); //Grab itemID and set to close open tab.
return false; //B2017-179 PasteReplace will return null if was aborted
}
return false;
}

View File

@ -1825,8 +1825,8 @@ namespace Volian.Controls.Library
EditItem newFocus = null;
EditItem nextEditItem = MyNextEditItem;
EditItem prevEditItem = MyPreviousEditItem;
if (MyStepPanel?.SelectedEditItem?.ActiveParent == null) return null; //Was causing an error when active parent was null and the replaced proc was opened in the editor.
EditItem parentEditItem = ActiveParent;
//if (MyStepPanel?.SelectedEditItem?.ActiveParent == null) return null; //Was causing an error// when active parent was null and the replaced proc was opened in the editor.
EditItem parentEditItem = MyStepPanel?.SelectedEditItem?.ActiveParent;
StepConfig savOrigPasteConfig = MyItemInfo.MyConfig as StepConfig;
int TopMostYBefore = TopMostEditItem.Top;