using System; using System.Collections.Generic; using System.Drawing; 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; } } public ItemInfo MyItemInfo { get; set; } public frmEnhanced(ItemInfo ii) { MyItemInfo = ii; InitializeComponent(); SetCaption(); } public void OpenItem() { tc.OpenItem(MyItemInfo); } private void frmEnhanced_Load(object sender, EventArgs e) { OpenItem(); } 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 { public int VersionID { get; set; } public int DBId { get; set; } 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 { 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); } } }