|
|
|
@@ -9,6 +9,7 @@ using System.Text.RegularExpressions;
|
|
|
|
|
using VEPROMS.CSLA.Library;
|
|
|
|
|
using Volian.Base.Library;
|
|
|
|
|
using JR.Utils.GUI.Forms;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace Volian.Controls.Library
|
|
|
|
|
{
|
|
|
|
@@ -893,6 +894,18 @@ namespace Volian.Controls.Library
|
|
|
|
|
b4topadjust -= newFocus.Top;
|
|
|
|
|
TopMostYBefore -= b4topadjust;
|
|
|
|
|
|
|
|
|
|
//B2024-075: If Deleting an item in a Source Document that is unlinked
|
|
|
|
|
//and the overall procedure has connected Background Documents
|
|
|
|
|
//and a window is open containing the background documents
|
|
|
|
|
//then need to force a refresh on that window as
|
|
|
|
|
//step numbering will shift
|
|
|
|
|
EnhancedDocuments ProcEnh = MyItemInfo.MyProcedure.GetMyEnhancedDocuments();
|
|
|
|
|
if (ProcEnh.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
DisplayTabItem wndowToRefresh = MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyBar.Items.Cast<DisplayTabItem>().FirstOrDefault(x => x.MyKey == $"Item - {ProcEnh[0].ItemID}");
|
|
|
|
|
wndowToRefresh?.MyStepTabPanel.MyStepPanel.Reset(wndowToRefresh.MyItemInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//_MyTimer.ActiveProcess = "Dispose";
|
|
|
|
|
Dispose();
|
|
|
|
|
//_MyTimer.ActiveProcess = "SetAllTabs";
|
|
|
|
@@ -1634,10 +1647,54 @@ namespace Volian.Controls.Library
|
|
|
|
|
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.Before, 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.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.Before, GetChangeId(MyItemInfo));
|
|
|
|
|
//if doing a paste before/after and item being copied is unlinked, item pasted should also be unlinked.
|
|
|
|
|
ItemInfo tmpCopyStartSourceItem = ItemInfo.Get(copyStartID);
|
|
|
|
|
ItemInfo newEnh = null;
|
|
|
|
|
if (tmpCopyStartSourceItem.GetMyEnhancedDocuments().Count > 0)
|
|
|
|
|
{
|
|
|
|
|
newEnh = newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.Before, GetChangeId(MyItemInfo));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//B2024-075: When doing Paste Before / After with Enhanced Documents only link from Background document to source was created
|
|
|
|
|
//since source is done first
|
|
|
|
|
//this is so that after the steps are created in the enhanced, go back and update the link in the source to point to the correct item
|
|
|
|
|
if (newEditItem != null && newEnh != null)
|
|
|
|
|
{
|
|
|
|
|
FixEnhanceLinkOnSource(newEditItem.MyItemInfo, newEnh, MyItemInfo.GetMyEnhancedDocuments());
|
|
|
|
|
}
|
|
|
|
|
else if (newEnh == null && newEditItem != null && newEditItem.MyItemInfo.IsEnhancedStep)
|
|
|
|
|
{
|
|
|
|
|
UnlinkEnhanced(newEditItem);
|
|
|
|
|
}
|
|
|
|
|
else if (newEnh == null && newEditItem != null)
|
|
|
|
|
{
|
|
|
|
|
//if did a paste before/after in a source document that contains enhanced steps
|
|
|
|
|
//but step being pasted was non-enhanced (unlinked)
|
|
|
|
|
//then look to see if the background page is open
|
|
|
|
|
//and if it is, do a refresh so that step numbers update appropriately
|
|
|
|
|
//without having to close and re-open the background steps
|
|
|
|
|
foreach (EnhancedDocument edSource in MyItemInfo.GetMyEnhancedDocuments())
|
|
|
|
|
{
|
|
|
|
|
ItemInfo exEnh = ItemInfo.Get(edSource.ItemID);
|
|
|
|
|
DisplayTabItem wndowToRefresh = newEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyBar.Items.Cast<DisplayTabItem>().FirstOrDefault(x => x.MyKey == $"Item - {exEnh.MyProcedure.ItemID}");
|
|
|
|
|
wndowToRefresh?.MyStepTabPanel.MyStepPanel.Reset(wndowToRefresh.MyItemInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if enhanced items were created, then see if they need displayed:
|
|
|
|
|
if (newEnh != null) AddAllEnhancedItemsToDisplay(newItemInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//B2024-075: When doing Paste Before / After with Enhanced Documents only link from Background document to source was created
|
|
|
|
|
//since source is done first
|
|
|
|
|
//this is so that after the steps are created in the enhanced, go back and update the link in the source to point to the correct item
|
|
|
|
|
//if enhanced document wasn't created then paste happened inside a enhanced Step/background step - so remove any links that shouldn't be there
|
|
|
|
|
//and don't have a corresponding spot in the Source
|
|
|
|
|
private void FixEnhanceLinkOnSource(ItemInfo SourceItem, ItemInfo newEnhItem, EnhancedDocuments enhancedDocuments)
|
|
|
|
|
{
|
|
|
|
|
if (enhancedDocuments.Count > 0)
|
|
|
|
|
CreateLinksEnhancedSingleItem(SourceItem, newEnhItem, enhancedDocuments[0].Type);
|
|
|
|
|
}
|
|
|
|
|
private void AddAllEnhancedItemsToDisplay(ItemInfo newItemInfo)
|
|
|
|
|
{
|
|
|
|
|
EnhancedDocuments eds = newItemInfo.GetMyEnhancedDocuments();
|
|
|
|
@@ -1684,12 +1741,15 @@ namespace Volian.Controls.Library
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void UnlinkEnhanced(ItemInfo enhII)
|
|
|
|
|
public void UnlinkEnhanced(EditItem enhII)
|
|
|
|
|
{
|
|
|
|
|
// B2022-049: Copy/paste of enhanced procedure and bad links between source and enhanced
|
|
|
|
|
// Pass in to unlink as before this change
|
|
|
|
|
enhII.DoUnlinkEnhanced(enhII, 0, false);
|
|
|
|
|
// B2024 - 075: Change made to pass in an EditTem instead of a ItemInfo
|
|
|
|
|
//so can refresh the UI
|
|
|
|
|
enhII.MyItemInfo.DoUnlinkEnhanced(enhII.MyItemInfo, 0, false);
|
|
|
|
|
SetFocus();
|
|
|
|
|
enhII.MyStepPanel.Reset(enhII.MyItemInfo); //need to reset parts so refreshes display to show as unlinked
|
|
|
|
|
}
|
|
|
|
|
public ItemInfo AddMissingEnhancedStep(ItemInfo ii, int EnhType)
|
|
|
|
|
{
|
|
|
|
@@ -1753,7 +1813,42 @@ namespace Volian.Controls.Library
|
|
|
|
|
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnItemPaste(this, new vlnTreeItemInfoPasteEventArgs(newItemInfo, copyStartID, ItemInfo.EAddpingPart.After, 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.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.After, GetChangeId(MyItemInfo));
|
|
|
|
|
//if doing a paste before/after and item being copied is unlinked, item pasted should also be unlinked.
|
|
|
|
|
ItemInfo tmpCopyStartSourceItem = ItemInfo.Get(copyStartID);
|
|
|
|
|
ItemInfo newEnh = null;
|
|
|
|
|
if (tmpCopyStartSourceItem.GetMyEnhancedDocuments().Count > 0)
|
|
|
|
|
{
|
|
|
|
|
newEnh = newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.After, GetChangeId(MyItemInfo));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//B2024-075: When doing Paste Before / After with Enhanced Documents only link from Background document to source was created
|
|
|
|
|
//since source is done first
|
|
|
|
|
//this is so that after the steps are created in the enhanced, go back and update the link in the source to point to the correct item
|
|
|
|
|
//if enhanced document wasn't created then paste happened inside a enhanced Step/background step - so remove any links that shouldn't be there
|
|
|
|
|
//and don't have a cooresponding spot in the Source
|
|
|
|
|
if (newEditItem != null && newEnh != null)
|
|
|
|
|
{
|
|
|
|
|
FixEnhanceLinkOnSource(newEditItem.MyItemInfo, newEnh, MyItemInfo.GetMyEnhancedDocuments());
|
|
|
|
|
}
|
|
|
|
|
else if (newEnh == null && newEditItem != null && newEditItem.MyItemInfo.IsEnhancedStep)
|
|
|
|
|
{
|
|
|
|
|
UnlinkEnhanced(newEditItem);
|
|
|
|
|
}
|
|
|
|
|
else if (newEnh == null && newEditItem != null)
|
|
|
|
|
{
|
|
|
|
|
//if did a paste before/after in a source document that contains enhanced steps
|
|
|
|
|
//but step being pasted was non-enhanced (unlinked)
|
|
|
|
|
//then look to see if the background page is open
|
|
|
|
|
//and if it is, do a refresh so that step numbers update appropriately
|
|
|
|
|
//without having to close and re-open the background steps
|
|
|
|
|
foreach (EnhancedDocument edSource in MyItemInfo.GetMyEnhancedDocuments())
|
|
|
|
|
{
|
|
|
|
|
ItemInfo exEnh = ItemInfo.Get(edSource.ItemID);
|
|
|
|
|
DisplayTabItem wndowToRefresh = newEditItem.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyBar.Items.Cast<DisplayTabItem>().FirstOrDefault(x => x.MyKey == $"Item - {exEnh.MyProcedure.ItemID}");
|
|
|
|
|
wndowToRefresh?.MyStepTabPanel.MyStepPanel.Reset(wndowToRefresh.MyItemInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (newEnh != null) AddAllEnhancedItemsToDisplay(newItemInfo);
|
|
|
|
|
}
|
|
|
|
|
public void PasteChild(int copyStartID)
|
|
|
|
|