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

View File

@ -1825,8 +1825,8 @@ namespace Volian.Controls.Library
EditItem newFocus = null; EditItem newFocus = null;
EditItem nextEditItem = MyNextEditItem; EditItem nextEditItem = MyNextEditItem;
EditItem prevEditItem = MyPreviousEditItem; 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. //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 = MyStepPanel?.SelectedEditItem?.ActiveParent;
StepConfig savOrigPasteConfig = MyItemInfo.MyConfig as StepConfig; StepConfig savOrigPasteConfig = MyItemInfo.MyConfig as StepConfig;
int TopMostYBefore = TopMostEditItem.Top; int TopMostYBefore = TopMostEditItem.Top;