B2024-037: Bug fix for copy/replace functionality on procedures and steps. #349

Merged
jjenko merged 4 commits from B2024-037 into Development 2024-07-11 10:54:10 -04:00
2 changed files with 17 additions and 3 deletions
Showing only changes of commit 21a83df99d - Show all commits

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) &&
@ -708,6 +708,11 @@ 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,17 @@ 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;
EditItem parentEditItem = null; // ActiveParent;
try
{
parentEditItem = ActiveParent ?? MyStepPanel?.SelectedEditItem?.ActiveParent;
}
catch (NullReferenceException)
{
// Handle the case where ActiveParent throws a NullReferenceException
parentEditItem = MyStepPanel?.SelectedEditItem?.ActiveParent;
}
//EditItem parentEditItem = MyStepPanel?.SelectedEditItem?.ActiveParent; // ActiveParent;
StepConfig savOrigPasteConfig = MyItemInfo.MyConfig as StepConfig;
int TopMostYBefore = TopMostEditItem.Top;