2015-09-14 12:44:15 +00:00

125 lines
2.8 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
namespace Volian.Controls.Library
{
public partial class frmEnhanced : Form
{
public SessionInfo MySessionInfo
{
get { return tc.MySessionInfo; }
set { tc.MySessionInfo = value; }
}
private ItemInfo _MyItemInfo;
public ItemInfo MyItemInfo
{
get { return _MyItemInfo; }
set { _MyItemInfo = value; }
}
public frmEnhanced(ItemInfo ii)
{
_MyItemInfo = ii;
InitializeComponent();
SetCaption();
}
public void OpenItem()
{
tc.OpenItem(_MyItemInfo);
}
private void frmEnhanced_Load(object sender, EventArgs e)
{
OpenItem();
}
public DisplayTabControl MyDisplayTabClntrol
{
get { return this.tc; }
}
private void SetCaption()
{
FolderInfo myfolder = _MyItemInfo.MyDocVersion.MyFolder;
string sep = "";
string fPath = "";
while (myfolder.FolderID != myfolder.ParentID)
{
fPath = myfolder.Name + sep + fPath;
sep = "/";
myfolder = myfolder.MyParent;
}
this.Text = fPath;
}
}
public class VersionWindow
{
private int _VersionID;
public int VersionID
{
get { return _VersionID; }
set { _VersionID = value; }
}
private int _DBId;
public int DBId
{
get { return _DBId; }
set { _DBId = value; }
}
private Rectangle _MyRectangle;
public Rectangle MyRectangle
{
get { return _MyRectangle; }
set { _MyRectangle = value; }
}
public override string ToString()
{
RectangleConverter rc = new RectangleConverter();
return string.Format("{0}~{1}", _VersionID, rc.ConvertToString(_MyRectangle));
}
public VersionWindow(string str)
{
string[] parts = str.Split('~');
_VersionID = int.Parse(parts[0]);
RectangleConverter rc = new RectangleConverter();
_MyRectangle = (Rectangle)rc.ConvertFromString(parts[1]);
}
}
public class VersionWindowList : List<VersionWindow>
{
public static VersionWindowList GetVersionWindowList(System.Collections.Specialized.StringCollection list)
{
VersionWindowList vwl = new VersionWindowList();
if (list != null)
{
foreach (string str in list)
vwl.Add(new VersionWindow(str));
}
return vwl;
}
public System.Collections.Specialized.StringCollection ToSettings()
{
if (Count == 0) return null;
System.Collections.Specialized.StringCollection retval = new System.Collections.Specialized.StringCollection();
foreach (VersionWindow vw in this)
retval.Add(vw.ToString());
return retval;
}
public new void Add(VersionWindow versionWindow)
{
foreach (VersionWindow vw in this)
{
if (vw.VersionID == versionWindow.VersionID)
{
this.Remove(vw);
break;
}
}
base.Add(versionWindow);
}
}
}