diff --git a/PROMS/Volian.Controls.Library/DisplayLibDocs.Designer.cs b/PROMS/Volian.Controls.Library/DisplayLibDocs.Designer.cs new file mode 100644 index 00000000..e580bd71 --- /dev/null +++ b/PROMS/Volian.Controls.Library/DisplayLibDocs.Designer.cs @@ -0,0 +1,326 @@ +namespace Volian.Controls.Library +{ + partial class DisplayLibDocs + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.groupPanelBtns = new DevComponents.DotNetBar.Controls.GroupPanel(); + this.btnImpLibDoc = new System.Windows.Forms.Button(); + this.groupPanelLibDocs = new DevComponents.DotNetBar.Controls.GroupPanel(); + this.listBoxLibDocs = new System.Windows.Forms.ListBox(); + this.pnlProp = new System.Windows.Forms.Panel(); + this.btnOpenLibDoc = new System.Windows.Forms.Button(); + this.btnDelLibDoc = new System.Windows.Forms.Button(); + this.btnCancel = new System.Windows.Forms.Button(); + this.btnSave = new System.Windows.Forms.Button(); + this.tbComment = new System.Windows.Forms.TextBox(); + this.tbName = new System.Windows.Forms.TextBox(); + this.lblComment = new System.Windows.Forms.Label(); + this.lblName = new System.Windows.Forms.Label(); + this.listBoxUsages = new System.Windows.Forms.ListBox(); + this.groupPanelUsages = new DevComponents.DotNetBar.Controls.GroupPanel(); + this.groupPanelBtns.SuspendLayout(); + this.groupPanelLibDocs.SuspendLayout(); + this.pnlProp.SuspendLayout(); + this.groupPanelUsages.SuspendLayout(); + this.SuspendLayout(); + // + // groupPanelBtns + // + this.groupPanelBtns.CanvasColor = System.Drawing.SystemColors.Control; + this.groupPanelBtns.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; + this.groupPanelBtns.Controls.Add(this.btnImpLibDoc); + this.groupPanelBtns.Dock = System.Windows.Forms.DockStyle.Top; + this.groupPanelBtns.Location = new System.Drawing.Point(0, 0); + this.groupPanelBtns.Margin = new System.Windows.Forms.Padding(4); + this.groupPanelBtns.Name = "groupPanelBtns"; + this.groupPanelBtns.Size = new System.Drawing.Size(501, 47); + // + // + // + this.groupPanelBtns.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.groupPanelBtns.Style.BackColorGradientAngle = 90; + this.groupPanelBtns.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.groupPanelBtns.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelBtns.Style.BorderBottomWidth = 1; + this.groupPanelBtns.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.groupPanelBtns.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelBtns.Style.BorderLeftWidth = 1; + this.groupPanelBtns.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelBtns.Style.BorderRightWidth = 1; + this.groupPanelBtns.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelBtns.Style.BorderTopWidth = 1; + this.groupPanelBtns.Style.CornerDiameter = 4; + this.groupPanelBtns.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.groupPanelBtns.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; + this.groupPanelBtns.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.groupPanelBtns.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; + this.groupPanelBtns.TabIndex = 25; + // + // btnImpLibDoc + // + this.btnImpLibDoc.Dock = System.Windows.Forms.DockStyle.Top; + this.btnImpLibDoc.Location = new System.Drawing.Point(0, 0); + this.btnImpLibDoc.Name = "btnImpLibDoc"; + this.btnImpLibDoc.Size = new System.Drawing.Size(495, 38); + this.btnImpLibDoc.TabIndex = 1; + this.btnImpLibDoc.Text = "Import Existing Word Document"; + this.btnImpLibDoc.UseVisualStyleBackColor = true; + this.btnImpLibDoc.Click += new System.EventHandler(this.btnImpLibDoc_Click); + // + // groupPanelLibDocs + // + this.groupPanelLibDocs.CanvasColor = System.Drawing.SystemColors.Control; + this.groupPanelLibDocs.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; + this.groupPanelLibDocs.Controls.Add(this.listBoxLibDocs); + this.groupPanelLibDocs.Dock = System.Windows.Forms.DockStyle.Top; + this.groupPanelLibDocs.Location = new System.Drawing.Point(0, 47); + this.groupPanelLibDocs.Margin = new System.Windows.Forms.Padding(4); + this.groupPanelLibDocs.Name = "groupPanelLibDocs"; + this.groupPanelLibDocs.Size = new System.Drawing.Size(501, 304); + // + // + // + this.groupPanelLibDocs.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.groupPanelLibDocs.Style.BackColorGradientAngle = 90; + this.groupPanelLibDocs.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.groupPanelLibDocs.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelLibDocs.Style.BorderBottomWidth = 1; + this.groupPanelLibDocs.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.groupPanelLibDocs.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelLibDocs.Style.BorderLeftWidth = 1; + this.groupPanelLibDocs.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelLibDocs.Style.BorderRightWidth = 1; + this.groupPanelLibDocs.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelLibDocs.Style.BorderTopWidth = 1; + this.groupPanelLibDocs.Style.CornerDiameter = 4; + this.groupPanelLibDocs.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.groupPanelLibDocs.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; + this.groupPanelLibDocs.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.groupPanelLibDocs.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; + this.groupPanelLibDocs.TabIndex = 27; + this.groupPanelLibDocs.Text = "Library Documents"; + // + // listBoxLibDocs + // + this.listBoxLibDocs.Dock = System.Windows.Forms.DockStyle.Fill; + this.listBoxLibDocs.FormattingEnabled = true; + this.listBoxLibDocs.HorizontalScrollbar = true; + this.listBoxLibDocs.ItemHeight = 16; + this.listBoxLibDocs.Location = new System.Drawing.Point(0, 0); + this.listBoxLibDocs.Margin = new System.Windows.Forms.Padding(4); + this.listBoxLibDocs.Name = "listBoxLibDocs"; + this.listBoxLibDocs.Size = new System.Drawing.Size(495, 276); + this.listBoxLibDocs.TabIndex = 13; + this.listBoxLibDocs.SelectedIndexChanged += new System.EventHandler(this.listBoxLibDocs_Click); + // + // pnlProp + // + this.pnlProp.Controls.Add(this.btnOpenLibDoc); + this.pnlProp.Controls.Add(this.btnDelLibDoc); + this.pnlProp.Controls.Add(this.btnCancel); + this.pnlProp.Controls.Add(this.btnSave); + this.pnlProp.Controls.Add(this.tbComment); + this.pnlProp.Controls.Add(this.tbName); + this.pnlProp.Controls.Add(this.lblComment); + this.pnlProp.Controls.Add(this.lblName); + this.pnlProp.Dock = System.Windows.Forms.DockStyle.Top; + this.pnlProp.Location = new System.Drawing.Point(0, 351); + this.pnlProp.Name = "pnlProp"; + this.pnlProp.Size = new System.Drawing.Size(501, 159); + this.pnlProp.TabIndex = 32; + // + // btnOpenLibDoc + // + this.btnOpenLibDoc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnOpenLibDoc.Location = new System.Drawing.Point(376, 120); + this.btnOpenLibDoc.Name = "btnOpenLibDoc"; + this.btnOpenLibDoc.Size = new System.Drawing.Size(108, 30); + this.btnOpenLibDoc.TabIndex = 14; + this.btnOpenLibDoc.Text = "Open"; + this.btnOpenLibDoc.UseVisualStyleBackColor = true; + this.btnOpenLibDoc.Click += new System.EventHandler(this.btnOpenLibDoc_Click); + // + // btnDelLibDoc + // + this.btnDelLibDoc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnDelLibDoc.Location = new System.Drawing.Point(263, 118); + this.btnDelLibDoc.Name = "btnDelLibDoc"; + this.btnDelLibDoc.Size = new System.Drawing.Size(107, 34); + this.btnDelLibDoc.TabIndex = 13; + this.btnDelLibDoc.Text = "Delete"; + this.btnDelLibDoc.UseVisualStyleBackColor = true; + this.btnDelLibDoc.Click += new System.EventHandler(this.btnDelLibDoc_Click); + // + // btnCancel + // + this.btnCancel.Location = new System.Drawing.Point(99, 80); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.TabIndex = 12; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); + // + // btnSave + // + this.btnSave.Location = new System.Drawing.Point(18, 80); + this.btnSave.Name = "btnSave"; + this.btnSave.Size = new System.Drawing.Size(75, 23); + this.btnSave.TabIndex = 11; + this.btnSave.Text = "Save"; + this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); + // + // tbComment + // + this.tbComment.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tbComment.Location = new System.Drawing.Point(83, 33); + this.tbComment.Multiline = true; + this.tbComment.Name = "tbComment"; + this.tbComment.Size = new System.Drawing.Size(400, 41); + this.tbComment.TabIndex = 10; + this.tbComment.TextChanged += new System.EventHandler(this.tbComment_TextChanged); + // + // tbName + // + this.tbName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tbName.Location = new System.Drawing.Point(70, 3); + this.tbName.Name = "tbName"; + this.tbName.Size = new System.Drawing.Size(413, 22); + this.tbName.TabIndex = 9; + this.tbName.TextChanged += new System.EventHandler(this.tbName_TextChanged); + // + // lblComment + // + this.lblComment.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lblComment.AutoSize = true; + this.lblComment.Location = new System.Drawing.Point(4, 31); + this.lblComment.Name = "lblComment"; + this.lblComment.Size = new System.Drawing.Size(71, 17); + this.lblComment.TabIndex = 8; + this.lblComment.Text = "Comment:"; + // + // lblName + // + this.lblName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lblName.AutoSize = true; + this.lblName.Location = new System.Drawing.Point(15, 8); + this.lblName.Name = "lblName"; + this.lblName.Size = new System.Drawing.Size(49, 17); + this.lblName.TabIndex = 7; + this.lblName.Text = "Name:"; + // + // listBoxUsages + // + this.listBoxUsages.Dock = System.Windows.Forms.DockStyle.Fill; + this.listBoxUsages.FormattingEnabled = true; + this.listBoxUsages.HorizontalScrollbar = true; + this.listBoxUsages.ItemHeight = 16; + this.listBoxUsages.Location = new System.Drawing.Point(0, 0); + this.listBoxUsages.Name = "listBoxUsages"; + this.listBoxUsages.Size = new System.Drawing.Size(495, 292); + this.listBoxUsages.TabIndex = 0; + this.listBoxUsages.SelectedValueChanged += new System.EventHandler(this.listBoxUsages_SelectedValueChanged); + // + // groupPanelUsages + // + this.groupPanelUsages.CanvasColor = System.Drawing.SystemColors.Control; + this.groupPanelUsages.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; + this.groupPanelUsages.Controls.Add(this.listBoxUsages); + this.groupPanelUsages.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupPanelUsages.Location = new System.Drawing.Point(0, 510); + this.groupPanelUsages.Margin = new System.Windows.Forms.Padding(4); + this.groupPanelUsages.Name = "groupPanelUsages"; + this.groupPanelUsages.Size = new System.Drawing.Size(501, 322); + // + // + // + this.groupPanelUsages.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.groupPanelUsages.Style.BackColorGradientAngle = 90; + this.groupPanelUsages.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.groupPanelUsages.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelUsages.Style.BorderBottomWidth = 1; + this.groupPanelUsages.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.groupPanelUsages.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelUsages.Style.BorderLeftWidth = 1; + this.groupPanelUsages.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelUsages.Style.BorderRightWidth = 1; + this.groupPanelUsages.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelUsages.Style.BorderTopWidth = 1; + this.groupPanelUsages.Style.CornerDiameter = 4; + this.groupPanelUsages.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.groupPanelUsages.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; + this.groupPanelUsages.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.groupPanelUsages.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; + this.groupPanelUsages.TabIndex = 31; + this.groupPanelUsages.Text = "Usages"; + // + // DisplayLibDocs + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoScroll = true; + this.Controls.Add(this.groupPanelUsages); + this.Controls.Add(this.pnlProp); + this.Controls.Add(this.groupPanelLibDocs); + this.Controls.Add(this.groupPanelBtns); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Name = "DisplayLibDocs"; + this.Size = new System.Drawing.Size(501, 832); + this.groupPanelBtns.ResumeLayout(false); + this.groupPanelLibDocs.ResumeLayout(false); + this.pnlProp.ResumeLayout(false); + this.pnlProp.PerformLayout(); + this.groupPanelUsages.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private DevComponents.DotNetBar.Controls.GroupPanel groupPanelBtns; + private DevComponents.DotNetBar.Controls.GroupPanel groupPanelLibDocs; + private System.Windows.Forms.ListBox listBoxLibDocs; + private System.Windows.Forms.Button btnImpLibDoc; + private System.Windows.Forms.Panel pnlProp; + private System.Windows.Forms.Button btnOpenLibDoc; + private System.Windows.Forms.Button btnDelLibDoc; + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Button btnSave; + private System.Windows.Forms.TextBox tbComment; + private System.Windows.Forms.TextBox tbName; + private System.Windows.Forms.Label lblComment; + private System.Windows.Forms.Label lblName; + private System.Windows.Forms.ListBox listBoxUsages; + private DevComponents.DotNetBar.Controls.GroupPanel groupPanelUsages; + } +} diff --git a/PROMS/Volian.Controls.Library/DisplayLibDocs.cs b/PROMS/Volian.Controls.Library/DisplayLibDocs.cs new file mode 100644 index 00000000..c5c1a690 --- /dev/null +++ b/PROMS/Volian.Controls.Library/DisplayLibDocs.cs @@ -0,0 +1,253 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Text; +using System.Windows.Forms; +using System.Text.RegularExpressions; +using System.IO; +using AT.STO.UI.Win; +using VEPROMS.CSLA.Library; + +namespace Volian.Controls.Library +{ + public partial class DisplayLibDocs : UserControl + { + #region Properties + private DocumentInfo _CurLibDoc; + public DocumentInfo CurLibDoc + { + get { return _CurLibDoc; } + set { _CurLibDoc = value; } + } + // selected index into listBoxLibDocs... + private int _SelectedLibDoc = -1; + private DocumentInfoList _LibDocList; + public DocumentInfoList LibDocList + { + get { return _LibDocList; } + set { _LibDocList = value; } + } + #endregion + #region Constructors + public DisplayLibDocs() + { + InitializeComponent(); + btnOpenLibDoc.Enabled = false; + btnDelLibDoc.Enabled = false; + } + DisplayTabControl _DisplayTabControl; + #endregion + #region LoadControlData + private bool _InitializingLibDocList; // used? see if selectionchanged event (still coding) + public void LibDocListFillIn(DisplayTabControl tc) + { + _InitializingLibDocList = true; + listBoxLibDocs.Items.Clear(); + btnSave.Enabled = false; + btnCancel.Enabled = false; + LibDocList = DocumentInfoList.GetLibraries(true); + for (int i = 0; i < LibDocList.Count; i++) + listBoxLibDocs.Items.Add(((LibDocList[i].DocumentEntries == null || LibDocList[i].DocumentEntries.Count == 0) ? "0 " : LibDocList[i].DocumentEntries.Count.ToString() + " ") + LibDocList[i].DocumentTitle); // + LibDocList[i].DocumentEntries.Count); + _DisplayTabControl = tc; + listBoxUsages.Items.Clear(); + _InitializingLibDocList = false; + } + #endregion + #region Events + private void listBoxLibDocs_Click(object sender, EventArgs e) + { + if (listBoxLibDocs.SelectedIndex == _SelectedLibDoc) return; + _SelectedLibDoc = listBoxLibDocs.SelectedIndex; + listBoxUsages.Items.Clear(); + tbComment.Clear(); + tbName.Clear(); + btnSave.Enabled = false; + btnCancel.Enabled = false; + _InitializingLibDocList = true; // need this so textchanged code doesn't turn save/cancel buttons on. + tbName.Text = LibDocList[_SelectedLibDoc].LibTitle; + + DocumentConfig dc = new DocumentConfig(LibDocList[_SelectedLibDoc]); + tbComment.Text = dc.LibDoc_Comment; + _InitializingLibDocList = false; + + // If there are no usages, then enable delete & open button (open for docs with usages occurs + // from usage list), otherwise disable buttons & list usages + DocumentInfo dicnt = LibDocList[_SelectedLibDoc]; + ItemInfoList iil = dicnt.LibraryDocumentUsageList; + if (iil == null) + { + btnDelLibDoc.Enabled = true; + btnOpenLibDoc.Enabled = true; + return; + } + // Put the usages in the usage list for the selected library document. + btnDelLibDoc.Enabled = false; + btnOpenLibDoc.Enabled = false; + DocumentInfo di = LibDocList[_SelectedLibDoc]; + foreach (ItemInfo ii in di.LibraryDocumentUsageList) + { + listBoxUsages.Items.Add(ii.MyProcedure.ToString() + " - " + ii.MyContent.Number + " " + ii.MyContent.Text); + } + } + private void btnDelLibDoc_Click(object sender, EventArgs e) + { + DocumentInfo di = LibDocList[_SelectedLibDoc]; + + try + { + Document.Delete(di.DocID); + } + catch (Exception ex) + { + Console.WriteLine("error deleting doc = " + ex.Message); + } + LibDocListFillIn(_DisplayTabControl); + } + private void btnSave_Click(object sender, EventArgs e) + { + bool chg = false; + DocumentInfo di = LibDocList[_SelectedLibDoc]; + Document doc = Document.Get(di.DocID); + if (tbName.Text != LibDocList[_SelectedLibDoc].LibTitle) + { + chg = true; + doc.LibTitle = tbName.Text; + } + DocumentConfig dc = new DocumentConfig(LibDocList[_SelectedLibDoc]); + if (tbComment.Text != dc.LibDoc_Comment) + { + chg = true; + dc.LibDoc_Comment = tbComment.Text; + doc.Config = dc.ToString(); + } + if (chg == true) + { + doc.Save(); + LibDocListFillIn(_DisplayTabControl); + } + } + private void btnCancel_Click(object sender, EventArgs e) + { + DocumentInfo di = LibDocList[_SelectedLibDoc]; + Document doc = Document.Get(di.DocID); + tbName.Text = doc.LibTitle; + DocumentConfig dc = new DocumentConfig(LibDocList[_SelectedLibDoc]); + tbComment.Text = dc.LibDoc_Comment; + btnSave.Enabled = false; + btnCancel.Enabled = false; + } + + private void btnOpenLibDoc_Click(object sender, EventArgs e) + { + DocumentInfo di = LibDocList[_SelectedLibDoc]; + _DisplayTabControl.OpenDSOTabPage(di); + } + + private void tbName_TextChanged(object sender, EventArgs e) + { + if (_InitializingLibDocList) return; + btnSave.Enabled = true; + btnCancel.Enabled = true; + } + + private void tbComment_TextChanged(object sender, EventArgs e) + { + if (_InitializingLibDocList) return; + btnSave.Enabled = true; + btnCancel.Enabled = true; + } + + + private void btnImpLibDoc_Click(object sender, EventArgs e) + { + OpenFileDialog openFileDialog1 = new OpenFileDialog(); + + openFileDialog1.InitialDirectory = "c:\\"; + openFileDialog1.Filter = "Word files (*.doc;*.rtf)|*.doc;*.rtf|All files (*.*)|*.*"; + openFileDialog1.FilterIndex = 0; + openFileDialog1.RestoreDirectory = true; + + if (openFileDialog1.ShowDialog() == DialogResult.OK) + { + int done = 0; + int ntry = 0; + while (done == 0 && ntry < 4) + { + ntry++; + done = SaveTheDoc(openFileDialog1.FileName, openFileDialog1.SafeFileName.Substring(0,openFileDialog1.SafeFileName.LastIndexOf("."))); + } + if (done > 0) + { + LibDocListFillIn(_DisplayTabControl); + // set selectedindex to the imported doc... + int indx = 0; + DocumentInfoList dil = DocumentInfoList.GetLibraries(true); + for(int i = 0; i + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/DisplayRO.cs b/PROMS/Volian.Controls.Library/DisplayRO.cs index 9babfe23..2ebb6b08 100644 --- a/PROMS/Volian.Controls.Library/DisplayRO.cs +++ b/PROMS/Volian.Controls.Library/DisplayRO.cs @@ -387,13 +387,10 @@ namespace Volian.Controls.Library { //string linktxt = string.Format("#Link:ReferencedObject: #xx {0}", roch.roid); string ROID = roch.roid; - //TODO: need to get the current user's USERID - RoUsage ro = RoUsage.MakeRoUsage(MyRTB.MyItemInfo.MyContent.Get(), ROID, null, DateTime.Now, "TEST"); - //string linktxt = string.Format(@"{0}{1}\v #Link:ReferencedObject:{2} {3}\v0", - // '\x15', MyROFST.GetRoValue(ROID.Substring(0, 12).ToUpper()), ro.ROUsageID, ROID); - string linktxt = string.Format(@"#Link:ReferencedObject:{0} {1}", ro.ROUsageID, ROID); - // Resolve symbols and scientific notation in the RO return value - _MyRTB.InsertRO(ConvertSymbolsAndStuff(tbROValue.Text), linktxt); + RoUsage ro = RoUsage.MakeRoUsage(MyRTB.MyItemInfo.MyContent.Get(), ROID, null); + string linktxt = string.Format(@"#Link:ReferencedObject:{0} {1}", ro.ROUsageID, ROID); + // Resolve symbols and scientific notation in the RO return value + _MyRTB.InsertRO(ConvertSymbolsAndStuff(tbROValue.Text), linktxt); } } else // we're in an Word attachment @@ -592,7 +589,7 @@ namespace Volian.Controls.Library outstr = outstr.Replace("\x2191", @"\u8593?"); outstr = outstr.Replace("\x2193", @"\u8595?"); outstr = outstr.Replace("\x2207", @"\u8711?"); - // TODO: DO WE NEED TO CHECK WHETHER TO REPLACE ^ CHARACTER FOR SETPOINTS? + // DisplayTODO: DO WE NEED TO CHECK WHETHER TO REPLACE ^ CHARACTER FOR SETPOINTS? //if (DoCaret) s2 = s2.Replace("^", @"\u916"); outstr = outstr.Replace("^", @"\u916"); diff --git a/PROMS/Volian.Controls.Library/DisplayTabControl.cs b/PROMS/Volian.Controls.Library/DisplayTabControl.cs index 90b2164f..bb08ae51 100644 --- a/PROMS/Volian.Controls.Library/DisplayTabControl.cs +++ b/PROMS/Volian.Controls.Library/DisplayTabControl.cs @@ -244,6 +244,16 @@ namespace Volian.Controls.Library /// /// 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); + } + } } /// /// 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();