B2016-023: For enhanced, display pasted steps in edit window if editor is open

B2016-025: Ribbon button enabling for enhanced support
This commit is contained in:
2016-01-29 15:03:43 +00:00
parent b087ce9996
commit 948fe7f1de
3 changed files with 50 additions and 23 deletions

View File

@@ -1355,9 +1355,35 @@ 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.
newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.Before, GetChangeId(MyItemInfo));
ItemInfo newEnh = newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.Before, GetChangeId(MyItemInfo));
// if enhanced items were created, then see if they need displayed:
if (newEnh != null) AddAllEnhancedItemsToDisplay(newItemInfo);
}
private void AddAllEnhancedItemsToDisplay(ItemInfo newItemInfo)
{
EnhancedDocuments eds = newItemInfo.GetMyEnhancedDocuments();
if (eds != null && eds.Count > 0)
{
foreach (EnhancedDocument ed in eds)
AddEnhancedItemToDisplayTabItem(ItemInfo.Get(ed.ItemID));
}
}
public void AddEnhancedItemToDisplayTabItem(ItemInfo newEnh)
{
// if tabcontrol was open for enhanced, display the steps:
ItemInfo proc = newEnh.MyProcedure; // Find procedure Item
string key = "Item - " + proc.ItemID.ToString();
if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl._MyDisplayTabItems.ContainsKey(key))
{
DisplayTabItem pg = MyStepPanel.MyStepTabPanel.MyDisplayTabControl._MyDisplayTabItems[key];
// _MyDisplayTabItems (in line above) had tabs that were closed, so use the next line
// to validate that the tab is still open.
foreach (DisplayTabItem ti in MyStepPanel.MyStepTabPanel.MyDisplayTabControl.MyBar.Items)
{
if (ti == pg) pg.MyStepTabPanel.MyStepPanel.GetEditItem(newEnh);
}
}
}
private string GetChangeId(ItemInfo iiDest)
{
// get the change id for the destination's procedure's change id.
@@ -1389,7 +1415,8 @@ 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.
newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.After, GetChangeId(MyItemInfo));
ItemInfo newEnh = newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.After, GetChangeId(MyItemInfo));
if (newEnh != null) AddAllEnhancedItemsToDisplay(newItemInfo);
}
public void PasteChild(int copyStartID)
{
@@ -1441,7 +1468,8 @@ namespace Volian.Controls.Library
MyStepPanel.SelectedEditItem = newEditItem;//Update Screen
// MyItemInfo is the 'paste from' item, if it has enhanced need to copy and paste the steps in enhanced.
newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.Child, GetChangeId(MyItemInfo));
ItemInfo newEnh = newItemInfo.EnhancedPasteItem(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.Child, GetChangeId(MyItemInfo));
if (newEnh != null) AddAllEnhancedItemsToDisplay(newItemInfo);
}
public EditItem PasteReplace(int copyStartID)
{
@@ -1521,7 +1549,8 @@ 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.
newItemInfo.PasteEnhancedItems(copyStartID, MyItemInfo, ItemInfo.EAddpingPart.Replace, GetChangeId(MyItemInfo));
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!!
return newEditItem;
}
private bool HandleSqlExceptionOnCopy(Exception ex)