MRI Capability
MyConfig for ItemInfo Fixed various problems with DisplayTabControl VEPROMS ribbon for DisplayTabPanel
This commit is contained in:
@@ -7,6 +7,7 @@ using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using VEPROMS.CSLA.Library;
|
||||
using Volian.Controls.Library;
|
||||
using DevComponents.DotNetBar;
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
@@ -14,6 +15,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
private Dictionary<string, DisplayTabItem> _MyPages;
|
||||
public event DisplayPanelEvent ItemClick;
|
||||
private List<DisplayTabItem> _RemovedItems = null;
|
||||
internal void OnItemClick(object sender, DisplayPanelEventArgs args)
|
||||
{
|
||||
if (ItemClick != null) ItemClick(sender, args);
|
||||
@@ -30,10 +32,100 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
private void SetUp()
|
||||
{
|
||||
_RemovedItems = new List<DisplayTabItem>();
|
||||
Dock = DockStyle.Fill;
|
||||
dotNetBarManager1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
|
||||
_MyPages = new Dictionary<string, DisplayTabItem>();
|
||||
//dotNetBarManager1.DockTabClosing += new DevComponents.DotNetBar.DockTabClosingEventHandler(dotNetBarManager1_DockTabClosing);
|
||||
//_MyBar.DockTabControl.CloseButtonOnTabsAlwaysDisplayed = true;
|
||||
SetupBar(_MyBar);
|
||||
dotNetBarManager1.BarTearOff += new EventHandler(dotNetBarManager1_BarTearOff);
|
||||
}
|
||||
void dotNetBarManager1_BarTearOff(object sender, EventArgs e)
|
||||
{
|
||||
Bar myBar = sender as Bar;
|
||||
//SetupBar(myBar);
|
||||
myBar.Enter += new EventHandler(myBar_Enter);
|
||||
}
|
||||
//private void ShowPG(object myObject)
|
||||
//{
|
||||
//frmPropGridTest tmp = new frmPropGridTest(myObject);
|
||||
//tmp.Show();
|
||||
//}
|
||||
private void SetupBar(Bar myBar)
|
||||
{
|
||||
if (myBar.DockTabControl != null)
|
||||
{
|
||||
myBar.DockTabControl.CloseButtonOnTabsVisible = true;
|
||||
myBar.DockTabControl.CloseButtonVisible = false;
|
||||
myBar.DockTabControl.CloseButtonPosition = DevComponents.DotNetBar.eTabCloseButtonPosition.Right;
|
||||
myBar.DockTabControl.Width = ClientRectangle.Width;
|
||||
//ShowPG(myBar);
|
||||
//ShowPG(myBar.DockTabControl);
|
||||
}
|
||||
myBar.DockTabClosing += new DockTabClosingEventHandler(myBar_DockTabClosing);
|
||||
if (!myBar.Visible)
|
||||
myBar.Visible = true;
|
||||
myBar.RecalcLayout();
|
||||
}
|
||||
|
||||
void myBar_Enter(object sender, EventArgs e)
|
||||
{
|
||||
Bar myBar = sender as Bar;
|
||||
myBar.Enter -= new EventHandler(myBar_Enter);
|
||||
SetupBar(sender as Bar);
|
||||
}
|
||||
|
||||
void myBar_DockTabClosing(object sender, DockTabClosingEventArgs e)
|
||||
{
|
||||
e.RemoveDockTab = true;
|
||||
_RemovedItems.Add((DisplayTabItem)e.DockContainerItem);
|
||||
//RemoveItem((DisplayTabItem)e.DockContainerItem);
|
||||
if (((Bar)sender).Items.Count == 1)// Remove bar if last item is closed...
|
||||
{
|
||||
dotNetBarManager1.Bars.Remove((Bar)sender);
|
||||
ActivateRemainingTab();
|
||||
}
|
||||
}
|
||||
private void ActivateRemainingTab()
|
||||
{
|
||||
foreach (Bar myBar in dotNetBarManager1.Bars)
|
||||
{
|
||||
if (myBar.DockSide == eDockSide.Document && myBar.Visible)
|
||||
{
|
||||
myBar.SelectedDockContainerItem.Selected = true;
|
||||
}
|
||||
}
|
||||
// No Document Tabs Remaining - need to raise OnItemSelectedChanged
|
||||
OnItemSelectedChanged(this, null);
|
||||
}
|
||||
private Bar GetFirstDocumentBar()
|
||||
{
|
||||
foreach (Bar b in dotNetBarManager1.Bars)
|
||||
{
|
||||
if (b.DockSide == eDockSide.Document && b.Visible)
|
||||
return b;
|
||||
}
|
||||
|
||||
// If no documents bars found, create new one
|
||||
//_UniqueBarCount++;
|
||||
Bar bar = BarUtilities.CreateDocumentBar();
|
||||
//bar.DockTabClosing += new DockTabClosingEventHandler(DocumentBar_DockTabClosing);
|
||||
//bar.Name = "barDocuments" + m_UniqueBarCount.ToString();
|
||||
fillDocDockSite.GetDocumentUIManager().Dock(bar);
|
||||
SetupBar(bar);
|
||||
return bar;
|
||||
}
|
||||
|
||||
|
||||
//void dotNetBarManager1_DockTabClosing(object sender, DevComponents.DotNetBar.DockTabClosingEventArgs e)
|
||||
//{
|
||||
// e.RemoveDockTab = true;
|
||||
// _RemovedItems.Add((DisplayTabItem)e.DockContainerItem);
|
||||
// //RemoveItem((DisplayTabItem)e.DockContainerItem);
|
||||
// if (((Bar)sender).Items.Count == 1) // Remove bar if last item is closed...
|
||||
// dotNetBarManager1.Bars.Remove((Bar)sender);
|
||||
//}
|
||||
public DevComponents.DotNetBar.Bar MyBar
|
||||
{
|
||||
get { return _MyBar; }
|
||||
@@ -41,15 +133,56 @@ namespace Volian.Controls.Library
|
||||
public DisplayTabItem SelectedTab
|
||||
{
|
||||
get { return (DisplayTabItem)_MyBar.SelectedDockContainerItem; }
|
||||
set { if(value != null)_MyBar.SelectedDockContainerItem = value; }
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
value.Selected = true;
|
||||
}
|
||||
}
|
||||
public DisplayTabItem OpenItem(ItemInfo myItem)
|
||||
{
|
||||
while (_RemovedItems.Count > 0)
|
||||
{
|
||||
DisplayTabItem tabItem = _RemovedItems[0];
|
||||
_RemovedItems.RemoveAt(0);
|
||||
RemoveItem(tabItem);
|
||||
}
|
||||
_MyBar = GetParentBar(myItem);
|
||||
if (myItem.MyContent.MyEntry == null)
|
||||
return OpenDisplayTabPage(myItem);
|
||||
else
|
||||
return OpenDSOTabPage(myItem);
|
||||
}
|
||||
|
||||
private Bar GetParentBar(ItemInfo myItem)
|
||||
{
|
||||
Bar myBar = null;
|
||||
foreach (Bar b in dotNetBarManager1.Bars)
|
||||
{
|
||||
if (b.DockSide == eDockSide.Document && b.Visible)
|
||||
{
|
||||
myBar = b;
|
||||
foreach (object itm in myBar.Items)
|
||||
{
|
||||
DisplayTabItem myTabItem = itm as DisplayTabItem;
|
||||
if (myTabItem != null && myTabItem.MyTabPanel != null)
|
||||
if (myTabItem.MyTabPanel.MyItem.ItemID == myItem.MyProcedure.ItemID)
|
||||
return myBar;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (myBar == null)
|
||||
{
|
||||
// If no documents bars found, create new one
|
||||
//_UniqueBarCount++;
|
||||
myBar = BarUtilities.CreateDocumentBar();
|
||||
//bar.DockTabClosing += new DockTabClosingEventHandler(DocumentBar_DockTabClosing);
|
||||
//bar.Name = "barDocuments" + m_UniqueBarCount.ToString();
|
||||
fillDocDockSite.GetDocumentUIManager().Dock(myBar);
|
||||
SetupBar(myBar);
|
||||
}
|
||||
return myBar;
|
||||
}
|
||||
private DisplayTabItem OpenDisplayTabPage(ItemInfo myItem)
|
||||
{
|
||||
ItemInfo proc = myItem.MyProcedure; // Find procedure Item
|
||||
@@ -58,18 +191,31 @@ namespace Volian.Controls.Library
|
||||
if (_MyPages.ContainsKey(key)) // If Procedure Open use it
|
||||
{
|
||||
pg = _MyPages[key];
|
||||
SelectedTab = pg;
|
||||
pg.Selected = true;
|
||||
//SelectedTab = pg;
|
||||
}
|
||||
else
|
||||
{
|
||||
pg = new DisplayTabItem(this.components, this, proc); // Open a new Procedure Tab
|
||||
pg = new DisplayTabItem(this.components, this, proc, key); // Open a new Procedure Tab
|
||||
//_MyBar.Items.Add(pg);
|
||||
_MyPages.Add(key, pg);
|
||||
SelectedTab = pg;
|
||||
pg.Selected = true;
|
||||
//SelectedTab = pg;
|
||||
pg.MyTabPanel.MyItem = proc;
|
||||
}
|
||||
Application.DoEvents();
|
||||
pg.ItemSelected = myItem; // Select the item
|
||||
return pg;
|
||||
}
|
||||
internal void RemoveItem(DisplayTabItem myItem)
|
||||
{
|
||||
_MyPages.Remove(myItem.MyKey);
|
||||
// Can I dispose the Panel
|
||||
myItem.MyTabPanel.Dispose();
|
||||
//myItem.Name = null;
|
||||
components.Remove(myItem);
|
||||
myItem.Dispose();
|
||||
}
|
||||
private DisplayTabItem OpenDSOTabPage(ItemInfo myItem)
|
||||
{
|
||||
DisplayTabItem pg = null;
|
||||
@@ -79,7 +225,7 @@ namespace Volian.Controls.Library
|
||||
pg = _MyPages[key];
|
||||
else
|
||||
{
|
||||
pg = new DisplayTabItem(this.components, this, myItem); // Open a new Procedure Tab
|
||||
pg = new DisplayTabItem(this.components, this, myItem,key); // Open a new Procedure Tab
|
||||
_MyPages.Add(key, pg);
|
||||
}
|
||||
SelectedTab = pg;
|
||||
|
Reference in New Issue
Block a user