diff --git a/PROMS/Volian.Controls.Library/DisplayTabControl.cs b/PROMS/Volian.Controls.Library/DisplayTabControl.cs index 4f16fa37..686d6a1b 100644 --- a/PROMS/Volian.Controls.Library/DisplayTabControl.cs +++ b/PROMS/Volian.Controls.Library/DisplayTabControl.cs @@ -283,12 +283,40 @@ namespace Volian.Controls.Library { CleanUpClosedItems(); _MyBar = GetParentBar(myItemInfo); // Get the docking bar associated with this item. - if (myItemInfo.MyContent.MyEntry == null) // If it is a Word document open it in Word + if (myItemInfo.MyContent.MyEntry == null) // If it is a Word document open in step editor return OpenStepTabPage(myItemInfo); - else // Otherwise open it in the step editor + else // Otherwise open it in the Word editor return OpenDSOTabPage(myItemInfo); } + public bool DeleteStepItem(ItemInfo myItemInfo) + { + CleanUpClosedItems(); + return DeleteStepTabItem(myItemInfo); + } + private bool DeleteStepTabItem(ItemInfo myItemInfo) + { + //removeitem! + ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item + string key = "Item - " + proc.ItemID.ToString(); + + if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it + { + DisplayTabItem pg = _MyDisplayTabItems[key]; + if (proc.ItemID == myItemInfo.ItemID) + { + CloseTabItem(pg); + return false; + } + if (pg.MyStepTabPanel.MyStepPanel._LookupStepItems.ContainsKey(myItemInfo.ItemID)) + { + StepItem stpitm = pg.MyStepTabPanel.MyStepPanel._LookupStepItems[myItemInfo.ItemID]; + stpitm.RemoveItem(); + return true; + } + } + return false; + } private void CleanUpClosedItems() { while (_RemovedDisplayTabItems.Count > 0) // Clean-up any items that have been closed. @@ -308,12 +336,17 @@ namespace Volian.Controls.Library myTabItem = _MyDisplayTabItems[key]; if (myTabItem.MyDSOTabPanel != null) { - Bar b = myTabItem.ContainerControl as Bar; - b.Items.Remove(myTabItem); - RemoveItem(myTabItem); + CloseTabItem(myTabItem); } } } + + private void CloseTabItem(DisplayTabItem myTabItem) + { + Bar b = myTabItem.ContainerControl as Bar; + b.Items.Remove(myTabItem); + RemoveItem(myTabItem); + } /// /// Look for a tab and set it to active. ///