This commit is contained in:
@@ -244,6 +244,16 @@ namespace Volian.Controls.Library
|
||||
/// <param name="myItemInfo"></param>
|
||||
/// <returns></returns>
|
||||
public DisplayTabItem OpenItem(ItemInfo myItemInfo)
|
||||
{
|
||||
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
|
||||
return OpenStepTabPage(myItemInfo);
|
||||
else // Otherwise open it in the step editor
|
||||
return OpenDSOTabPage(myItemInfo);
|
||||
}
|
||||
|
||||
private void CleanUpClosedItems()
|
||||
{
|
||||
while (_RemovedDisplayTabItems.Count > 0) // Clean-up any items that have been closed.
|
||||
{
|
||||
@@ -251,11 +261,21 @@ namespace Volian.Controls.Library
|
||||
_RemovedDisplayTabItems.RemoveAt(0);
|
||||
RemoveItem(myTabItem);
|
||||
}
|
||||
_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
|
||||
return OpenStepTabPage(myItemInfo);
|
||||
else // Otherwise open it in the step editor
|
||||
return OpenDSOTabPage(myItemInfo);
|
||||
}
|
||||
public void CloseWordItem(ItemInfo myItemInfo)
|
||||
{
|
||||
string key = "Doc - " + myItemInfo.MyContent.MyEntry.MyDocument.DocID.ToString();
|
||||
DisplayTabItem myTabItem = null;
|
||||
if (_MyDisplayTabItems.ContainsKey(key)) // If page open, close it
|
||||
{
|
||||
myTabItem = _MyDisplayTabItems[key];
|
||||
if (myTabItem.MyDSOTabPanel != null)
|
||||
{
|
||||
Bar b = myTabItem.ContainerControl as Bar;
|
||||
b.Items.Remove(myTabItem);
|
||||
RemoveItem(myTabItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Look for a tab and set it to active.
|
||||
@@ -306,7 +326,7 @@ namespace Volian.Controls.Library
|
||||
public DisplayTabItem SelectedDisplayTabItem
|
||||
{
|
||||
get { return (DisplayTabItem)_MyBar.SelectedDockContainerItem; }
|
||||
set
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
@@ -328,7 +348,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (b.DockSide == eDockSide.Document && b.Visible)
|
||||
{
|
||||
if(myBar == null)myBar = b;// Remember the first available bar if a specific bar cannot be found
|
||||
if (myBar == null) myBar = b;// Remember the first available bar if a specific bar cannot be found
|
||||
foreach (object itm in b.Items)
|
||||
{
|
||||
DisplayTabItem myTabItem = itm as DisplayTabItem;
|
||||
@@ -343,7 +363,7 @@ namespace Volian.Controls.Library
|
||||
// If no documents bars found, create new one
|
||||
_UniqueBarCount++;
|
||||
myBar = BarUtilities.CreateDocumentBar();
|
||||
myBar.DockTabClosing +=new DockTabClosingEventHandler(myBar_DockTabClosing);
|
||||
myBar.DockTabClosing += new DockTabClosingEventHandler(myBar_DockTabClosing);
|
||||
myBar.Name = "barDocuments" + _UniqueBarCount.ToString();
|
||||
fillDocDockSite.GetDocumentUIManager().Dock(myBar);
|
||||
SetupBar(myBar);
|
||||
@@ -399,7 +419,28 @@ namespace Volian.Controls.Library
|
||||
MessageBox.Show("Too many Word Documents Open. Please close one of the Documents before attempting to open another");
|
||||
return null;
|
||||
}
|
||||
pg = new DisplayTabItem(this.components, this, myItemInfo,key); // Open a new document page
|
||||
pg = new DisplayTabItem(this.components, this, myItemInfo, key); // Open a new document page
|
||||
_MyDisplayTabItems.Add(key, pg);
|
||||
}
|
||||
SelectedDisplayTabItem = pg;
|
||||
pg.MyDSOTabPanel.EnterPanel();
|
||||
return pg;
|
||||
}
|
||||
public DisplayTabItem OpenDSOTabPage(DocumentInfo myDocumentInfo)
|
||||
{
|
||||
CleanUpClosedItems();
|
||||
DisplayTabItem pg = null;
|
||||
string key = "Doc - " + myDocumentInfo.DocID;
|
||||
if (_MyDisplayTabItems.ContainsKey(key)) // If document page open use it
|
||||
pg = _MyDisplayTabItems[key];
|
||||
else
|
||||
{
|
||||
if (DSOTabPanel.Count > 18) // Limit the number of open document pages to 18
|
||||
{
|
||||
MessageBox.Show("Too many Word Documents Open. Please close one of the Documents before attempting to open another");
|
||||
return null;
|
||||
}
|
||||
pg = new DisplayTabItem(this.components, this, myDocumentInfo, key); // Open a new document page
|
||||
_MyDisplayTabItems.Add(key, pg);
|
||||
}
|
||||
SelectedDisplayTabItem = pg;
|
||||
@@ -414,7 +455,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
_MyDisplayTabItems.Remove(myDisplayTabItem.MyKey);
|
||||
// Dispose the Panel
|
||||
if(myDisplayTabItem.MyStepTabPanel!=null)
|
||||
if (myDisplayTabItem.MyStepTabPanel != null)
|
||||
myDisplayTabItem.MyStepTabPanel.Dispose();
|
||||
if (myDisplayTabItem.MyDSOTabPanel != null)
|
||||
myDisplayTabItem.MyDSOTabPanel.CloseDSO();
|
||||
|
Reference in New Issue
Block a user