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:
Kathy Ruffing 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)

View File

@ -796,22 +796,7 @@ namespace Volian.Controls.Library
if (EnhAddType == EnhancedAddTypes.Before) addpart = ItemInfo.EAddpingPart.Before;
else if (EnhAddType == EnhancedAddTypes.Child) addpart = ItemInfo.EAddpingPart.Child;
ItemInfo newEnh = MyItemInfo.DoAddEnhancedSteps(ed.Type, ed.ItemID, addpart);
if (newEnh != null)
{
// 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);
}
}
}
if (newEnh != null) AddEnhancedItemToDisplayTabItem(newEnh);
}
EnhAddType = EnhancedAddTypes.No;
}

View File

@ -1123,7 +1123,20 @@ namespace Volian.Controls.Library
// for now (Jan 2016 - initial implementation of enhanced document support) do NOT paste any step (MyCopyStep) that has enhanced data associated
// with it unless pasting within a enhanced source document. The reason is that code would need to handle clearing the pasted enhanced config
// data if it is pasted into a non-enhanced location.
if ((!MyItemInfo.IsEnhancedSection && !MyItemInfo.IsEnhancedStep) && tmp.MyDisplayTabControl.MyCopyStep.IsEnhancedStep)
StepConfig stepToCfg = null;
bool fromSourceHasEnhancedLinks = false;
bool toSourceHasEnhancedLinks = false;
if (tmp.MyDisplayTabControl.MyCopyStep.IsHigh)
{
stepToCfg = tmp.MyDisplayTabControl.MyCopyStep.MyConfig as StepConfig;
if (stepToCfg.MyEnhancedDocuments != null && stepToCfg.MyEnhancedDocuments.Count > 0 && stepToCfg.MyEnhancedDocuments[0].Type != 0) fromSourceHasEnhancedLinks = true;
if (MyItemInfo.IsHigh)
{
stepToCfg = MyItemInfo.MyConfig as StepConfig;
if (stepToCfg.MyEnhancedDocuments != null && stepToCfg.MyEnhancedDocuments.Count > 0 && stepToCfg.MyEnhancedDocuments[0].Type != 0) toSourceHasEnhancedLinks = true;
}
}
if ((!MyItemInfo.IsEnhancedSection && !MyItemInfo.IsEnhancedStep && !toSourceHasEnhancedLinks) && fromSourceHasEnhancedLinks)
{
btnPasteBefore.Enabled = btnCMPasteBefore.Enabled = false;
btnPasteAfter.Enabled = btnCMPasteAfter.Enabled = false;
@ -1133,7 +1146,7 @@ namespace Volian.Controls.Library
// enhanced: if 'from' step is not enhanced, only allow paste before/after
if (MyItemInfo.IsHigh && !MyItemInfo.IsEnhancedStep)
{
StepConfig stepToCfg = MyItemInfo.MyConfig as StepConfig;
stepToCfg = MyItemInfo.MyConfig as StepConfig;
if (stepToCfg.MyEnhancedDocuments != null && stepToCfg.MyEnhancedDocuments.Count>0 && stepToCfg.MyEnhancedDocuments[0].Type != 0)
{
// Current selected step is source (i.e. has enhanced links to enhanced steps)