85 lines
2.2 KiB
C#
85 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Data;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using VEPROMS.CSLA.Library;
|
|
using Volian.Controls.Library;
|
|
|
|
namespace Volian.Controls.Library
|
|
{
|
|
public partial class DisplayTabControl : UserControl
|
|
{
|
|
public event DisplayPanelEvent ItemClick;
|
|
private Dictionary<string, DisplayTabItem> _MyPages;
|
|
internal void OnItemClick(object sender, DisplayPanelEventArgs args)
|
|
{
|
|
if (ItemClick != null) ItemClick(sender, args);
|
|
}
|
|
public DisplayTabControl()
|
|
{
|
|
InitializeComponent();
|
|
SetUp();
|
|
}
|
|
private void SetUp()
|
|
{
|
|
Dock = DockStyle.Fill;
|
|
dotNetBarManager1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
|
|
_MyPages = new Dictionary<string, DisplayTabItem>();
|
|
}
|
|
public DevComponents.DotNetBar.Bar MyBar
|
|
{
|
|
get { return _MyBar; }
|
|
}
|
|
public DisplayTabItem SelectedTab
|
|
{
|
|
get { return (DisplayTabItem)_MyBar.SelectedDockContainerItem; }
|
|
set { if(value != null)_MyBar.SelectedDockContainerItem = value; }
|
|
}
|
|
public DisplayTabItem OpenItem(ItemInfo myItem)
|
|
{
|
|
if (myItem.MyContent.MyEntry == null)
|
|
return OpenDisplayTabPage(myItem);
|
|
else
|
|
return OpenDSOTabPage(myItem);
|
|
}
|
|
private DisplayTabItem OpenDisplayTabPage(ItemInfo myItem)
|
|
{
|
|
ItemInfo proc = myItem.MyProcedure; // Find procedure Item
|
|
string key = "Item - " + proc.ItemID.ToString();
|
|
DisplayTabItem pg = null;
|
|
if (_MyPages.ContainsKey(key)) // If Procedure Open use it
|
|
{
|
|
pg = _MyPages[key];
|
|
SelectedTab = pg;
|
|
}
|
|
else
|
|
{
|
|
pg = new DisplayTabItem(this.components, this, proc); // Open a new Procedure Tab
|
|
_MyPages.Add(key, pg);
|
|
SelectedTab = pg;
|
|
pg.MyTabPanel.MyItem = proc;
|
|
}
|
|
pg.ItemSelected = myItem; // Select the item
|
|
return pg;
|
|
}
|
|
private DisplayTabItem OpenDSOTabPage(ItemInfo myItem)
|
|
{
|
|
DisplayTabItem pg = null;
|
|
EntryInfo myEntry = myItem.MyContent.MyEntry;
|
|
string key = "Doc - " + myEntry.DocID;
|
|
if (_MyPages.ContainsKey(key)) // If Procedure Open use it
|
|
pg = _MyPages[key];
|
|
else
|
|
{
|
|
pg = new DisplayTabItem(this.components, this, myItem); // Open a new Procedure Tab
|
|
_MyPages.Add(key, pg);
|
|
}
|
|
SelectedTab = pg;
|
|
return pg;
|
|
}
|
|
}
|
|
}
|