diff --git a/PROMS/VEPROMS User Interface/App.config b/PROMS/VEPROMS User Interface/App.config index 81e43dc1..cb874db7 100644 --- a/PROMS/VEPROMS User Interface/App.config +++ b/PROMS/VEPROMS User Interface/App.config @@ -85,8 +85,8 @@ - - + + diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs index 1e2d6994..a59bc161 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs @@ -72,6 +72,7 @@ namespace VEPROMS this.labelItem11 = new DevComponents.DotNetBar.LabelItem(); this.btnItemInfo = new DevComponents.DotNetBar.ButtonItem(); this.lblItemID = new DevComponents.DotNetBar.LabelItem(); + this.lblResolution = new DevComponents.DotNetBar.LabelItem(); this.epAnnotations = new DevComponents.DotNetBar.ExpandablePanel(); this.ctrlAnnotationDetails = new Volian.Controls.Library.AnnotationDetails(); this.btnAnnoDetailsPushPin = new DevComponents.DotNetBar.ButtonX(); @@ -455,7 +456,8 @@ namespace VEPROMS this.lblEditView, this.labelItem11, this.btnItemInfo, - this.lblItemID}); + this.lblItemID, + this.lblResolution}); this.bottomBar.Location = new System.Drawing.Point(5, 650); this.bottomBar.Name = "bottomBar"; this.bottomBar.Size = new System.Drawing.Size(1185, 29); @@ -539,6 +541,14 @@ namespace VEPROMS this.lblItemID.Name = "lblItemID"; this.lblItemID.Text = "ItemID=\"\""; // + // lblResolution + // + this.lblResolution.BackColor = System.Drawing.Color.Transparent; + this.lblResolution.ForeColor = System.Drawing.SystemColors.MenuText; + this.lblResolution.Name = "lblResolution"; + this.lblResolution.Text = "Edit"; + this.lblResolution.Click += new System.EventHandler(this.lblResolution_Click); + // // epAnnotations // this.epAnnotations.CanvasColor = System.Drawing.SystemColors.Control; @@ -1053,8 +1063,10 @@ namespace VEPROMS this.displaySearch1.MyROFSTLookup = null; this.displaySearch1.Name = "displaySearch1"; this.displaySearch1.ProgressBar = null; + this.displaySearch1.ReportTitle = null; this.displaySearch1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.displaySearch1.SearchResults = null; + this.displaySearch1.SearchString = null; this.displaySearch1.Size = new System.Drawing.Size(1, 603); this.displaySearch1.TabIndex = 0; // @@ -1241,6 +1253,7 @@ namespace VEPROMS this.Text = "VE-PROMS"; this.Load += new System.EventHandler(this.frmVEPROMS_Load); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmVEPROMS_FormClosing); + this.Resize += new System.EventHandler(this.frmVEPROMS_Resize); ((System.ComponentModel.ISupportInitialize)(this.bottomBar)).EndInit(); this.bottomBar.ResumeLayout(false); this.epAnnotations.ResumeLayout(false); @@ -1374,6 +1387,7 @@ namespace VEPROMS private DevComponents.DotNetBar.LabelItem lblItemID; private System.Windows.Forms.ComboBox cmbFont; private DevComponents.DotNetBar.ButtonItem btnRepaginate; + private DevComponents.DotNetBar.LabelItem lblResolution; } } diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index fd6b5d2f..372f6da6 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -152,8 +152,16 @@ namespace VEPROMS ribbonControl1.ExpandedChanged += new EventHandler(ribbonControl1_ExpandedChanged); dlgFindReplace = new FindReplace(); SpellChecker = new VlnSpellCheck(); + displaySearch1.PrintRequest += new DisplaySearchEvent(displaySearch1_PrintRequest); + } + void displaySearch1_PrintRequest(object sender, DisplaySearchEventArgs args) + { + Volian.Print.Library.PDFReport myReport = new Volian.Print.Library.PDFReport(args.ReportTitle, args.MyItemInfoList, @"C:\temp\searchresults.pdf"); + if (args.SearchString != null) + myReport.SearchString = args.SearchString; + myReport.Build(); + System.Diagnostics.Process.Start(myReport.FileName); } - bool tv_InsertItemInfo(object sender, vlnTreeItemInfoInsertEventArgs args) { return tc.InsertStepItem(args.MyItemInfo, args.StepText, args.InsertType, args.FromType, args.Type); @@ -1305,7 +1313,28 @@ namespace VEPROMS //} //string pnum = DisplayText.StaticStripRtfCommands(this._CurrentItem.MyProcedure.ProcedureConfig.Number).Replace("\\u8209?", "-"); DlgPrintProcedure prnDlg = new DlgPrintProcedure(this._CurrentItem.MyProcedure);//dvi.DocVersionConfig,pnum); - prnDlg.ShowDialog(); + prnDlg.Show(); + } + + private void lblResolution_Click(object sender, EventArgs e) + { + if (this.WindowState != FormWindowState.Normal) + { + this.WindowState = FormWindowState.Normal; + } + else if (this.Size.Width != 1280) + { + this.Size = new Size(1280, 800); + } + else + { + this.Size = new Size(1024, 768); + } + } + + private void frmVEPROMS_Resize(object sender, EventArgs e) + { + lblResolution.Text = string.Format("Resolution {0} x {1}", Size.Width, Size.Height); } } diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs index bc024f1c..12a4374f 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs @@ -12,6 +12,8 @@ using System.Text.RegularExpressions; using LBWordLibrary; using System.Drawing.Imaging; using Volian.Base.Library; +using System.Diagnostics; + namespace VEPROMS.CSLA.Library { @@ -333,6 +335,12 @@ namespace VEPROMS.CSLA.Library } public static class MSWordToPDF { + private static bool _CloseWordWhenDone = true; + public static bool CloseWordWhenDone + { + get { return MSWordToPDF._CloseWordWhenDone; } + set { MSWordToPDF._CloseWordWhenDone = value; } + } private static LBApplicationClass _MyApp = null; public static LBApplicationClass MyApp { @@ -417,6 +425,24 @@ namespace VEPROMS.CSLA.Library // string AccPageID = string.Format("<{0}-{1}>", accPrefix, roch.appid); using (DSOFile myFile = new DSOFile(sect.MyContent.MyEntry.MyDocument)) { + // Increase the priority of the Word Process so that the pdf creation happens quickly + Process[] myProcessess = Process.GetProcessesByName("winword"); + foreach (Process myProcess in myProcessess) + { + try + { + if (myProcess.PriorityClass != ProcessPriorityClass.High && myProcess.MainWindowTitle == "") + myProcess.PriorityClass = ProcessPriorityClass.High; + } + catch (Exception ex) + { + while (ex != null) + { + Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message); + ex = ex.InnerException; + } + } + } LBDocumentClass myDoc = MyApp.Documents.Open(myFile.FullName, false); float newTop = (float)myDocStyle.Layout.TopRow; float newLeft = (float)myDocStyle.Layout.LeftMargin; @@ -527,11 +553,26 @@ namespace VEPROMS.CSLA.Library sel.ParagraphFormat.LineSpacing = 12; fileName = CreatePDF(fileName, openPdf); MyApp.ActiveDocument.Close(false); - MyApp.Quit(false); - _MyApp = null; + if (CloseWordWhenDone) + { + WaitMS(300);// This was added because MSWord will sometimes get the error below + // Microsoft Office Word has stopped working + // It appears that this is caused by quiting the MS Word application + // to soon after closing the document or doing an export. + MyApp.Quit(false); + _MyApp = null; + } return fileName; } } + private static void WaitMS(int n) + { + DateTime dtw = DateTime.Now.AddMilliseconds(n); + while (DateTime.Now < dtw) + { + System.Windows.Forms.Application.DoEvents(); + } + } private static int WordColor(System.Drawing.Color color) { System.Drawing.Color c1 = System.Drawing.Color.FromArgb(0, color.B, color.G, color.R); diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index ca51f1d8..0bbdb4a0 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -312,6 +312,17 @@ namespace VEPROMS.CSLA.Library } set { _StepLevel = value; } } + public string ToolTip + { + get + { + if (IsStep) + return FormatStepData.Type; + else if (IsSection) + return MyDocStyle.Name; + return "Procedure Title"; + } + } public bool HasCautionOrNote { get { return Cautions != null || Notes != null; } diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs index 810a4a2c..34186b5d 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs @@ -320,7 +320,8 @@ namespace VEPROMS.CSLA.Library } public static string GetResolvedText(FormatInfo formatInfo, ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem) { - TransitionBuilder tb = SetupTransitionBuilder(formatInfo, fromInfo, tranType, toItem, rangeItem); + TransitionBuilder tb = SetupTransitionBuilder(formatInfo, fromInfo, tranType, toItem, + toItem.ItemID==rangeItem.ItemID && !toItem.IsHigh?toItem.LastSibling:rangeItem); if(_AppendMethods==null) SetupMethods(); return BuildString(tb); @@ -360,6 +361,11 @@ namespace VEPROMS.CSLA.Library } int endtokn = tb._TransFormat.IndexOf("}", index); string token = tb._TransFormat.Substring(index, endtokn - index + 1); + if (token == "{.}" && tb._ToItem.ItemID == tb._RangeItem.ItemID) + { + startIndex = tb._TransFormat.Length; // skip the rest of the trans format + break; + } if (_AppendMethods.ContainsKey(token)) textAdded = _AppendMethods[token](textAdded, tb, token, nonToken); else diff --git a/PROMS/VEPROMS/PrintMSWord/frmPrintMsWord.Designer.cs b/PROMS/VEPROMS/PrintMSWord/frmPrintMsWord.Designer.cs index e7433b04..c27f976c 100644 --- a/PROMS/VEPROMS/PrintMSWord/frmPrintMsWord.Designer.cs +++ b/PROMS/VEPROMS/PrintMSWord/frmPrintMsWord.Designer.cs @@ -34,6 +34,7 @@ namespace PrintMSWord this.pDFToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pDFsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.tspbStatus = new System.Windows.Forms.ToolStripProgressBar(); this.tsslStatus = new System.Windows.Forms.ToolStripStatusLabel(); this.panel1 = new System.Windows.Forms.Panel(); this.cbDebugOutput = new DevComponents.DotNetBar.Controls.CheckBoxX(); @@ -58,8 +59,7 @@ namespace PrintMSWord this.pDFsToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Padding = new System.Windows.Forms.Padding(8, 2, 0, 2); - this.menuStrip1.Size = new System.Drawing.Size(1125, 28); + this.menuStrip1.Size = new System.Drawing.Size(844, 24); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = "menuStrip1"; // @@ -68,44 +68,50 @@ namespace PrintMSWord this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.exitToolStripMenuItem}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(44, 24); + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); this.fileToolStripMenuItem.Text = "&File"; // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(102, 24); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(92, 22); this.exitToolStripMenuItem.Text = "E&xit"; // // pDFToolStripMenuItem // this.pDFToolStripMenuItem.Name = "pDFToolStripMenuItem"; - this.pDFToolStripMenuItem.Size = new System.Drawing.Size(47, 24); + this.pDFToolStripMenuItem.Size = new System.Drawing.Size(40, 20); this.pDFToolStripMenuItem.Text = "PDF"; this.pDFToolStripMenuItem.Click += new System.EventHandler(this.pDFToolStripMenuItem_Click); // // pDFsToolStripMenuItem // this.pDFsToolStripMenuItem.Name = "pDFsToolStripMenuItem"; - this.pDFsToolStripMenuItem.Size = new System.Drawing.Size(53, 24); + this.pDFsToolStripMenuItem.Size = new System.Drawing.Size(45, 20); this.pDFsToolStripMenuItem.Text = "PDFs"; this.pDFsToolStripMenuItem.Click += new System.EventHandler(this.pDFsToolStripMenuItem_Click); // // statusStrip1 // this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.tspbStatus, this.tsslStatus}); - this.statusStrip1.Location = new System.Drawing.Point(0, 390); + this.statusStrip1.Location = new System.Drawing.Point(0, 315); this.statusStrip1.Name = "statusStrip1"; - this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 19, 0); - this.statusStrip1.Size = new System.Drawing.Size(1125, 25); + this.statusStrip1.Size = new System.Drawing.Size(844, 22); this.statusStrip1.TabIndex = 1; this.statusStrip1.Text = "statusStrip1"; // + // tspbStatus + // + this.tspbStatus.Name = "tspbStatus"; + this.tspbStatus.Size = new System.Drawing.Size(100, 16); + this.tspbStatus.Visible = false; + // // tsslStatus // this.tsslStatus.Name = "tsslStatus"; - this.tsslStatus.Size = new System.Drawing.Size(50, 20); + this.tsslStatus.Size = new System.Drawing.Size(39, 17); this.tsslStatus.Text = "Ready"; // // panel1 @@ -119,10 +125,9 @@ namespace PrintMSWord this.panel1.Controls.Add(this.tbRev); this.panel1.Controls.Add(this.label1); this.panel1.Dock = System.Windows.Forms.DockStyle.Right; - this.panel1.Location = new System.Drawing.Point(646, 28); - this.panel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.panel1.Location = new System.Drawing.Point(485, 24); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(479, 362); + this.panel1.Size = new System.Drawing.Size(359, 291); this.panel1.TabIndex = 2; // // cbDebugOutput @@ -131,14 +136,13 @@ namespace PrintMSWord // // this.cbDebugOutput.BackgroundStyle.Class = ""; - this.cbDebugOutput.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.cbDebugOutput.Checked = true; this.cbDebugOutput.CheckState = System.Windows.Forms.CheckState.Checked; this.cbDebugOutput.CheckValue = "Y"; - this.cbDebugOutput.Location = new System.Drawing.Point(11, 39); - this.cbDebugOutput.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.cbDebugOutput.Location = new System.Drawing.Point(8, 32); + this.cbDebugOutput.Margin = new System.Windows.Forms.Padding(2); this.cbDebugOutput.Name = "cbDebugOutput"; - this.cbDebugOutput.Size = new System.Drawing.Size(147, 23); + this.cbDebugOutput.Size = new System.Drawing.Size(110, 19); this.cbDebugOutput.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.cbDebugOutput.TabIndex = 9; this.cbDebugOutput.Text = "Debug Output"; @@ -147,23 +151,21 @@ namespace PrintMSWord // this.tbTimings.AcceptsReturn = true; this.tbTimings.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tbTimings.Location = new System.Drawing.Point(0, 69); - this.tbTimings.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tbTimings.Location = new System.Drawing.Point(0, 56); this.tbTimings.Multiline = true; this.tbTimings.Name = "tbTimings"; this.tbTimings.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.tbTimings.Size = new System.Drawing.Size(477, 292); + this.tbTimings.Size = new System.Drawing.Size(359, 235); this.tbTimings.TabIndex = 8; // // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(240, 39); - this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label3.Location = new System.Drawing.Point(180, 32); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(77, 17); + this.label3.Size = new System.Drawing.Size(59, 13); this.label3.TabIndex = 5; this.label3.Text = "Watermark"; // @@ -177,49 +179,44 @@ namespace PrintMSWord "Sample", "Reference", "Information Only"}); - this.cbWatermark.Location = new System.Drawing.Point(327, 36); - this.cbWatermark.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cbWatermark.Location = new System.Drawing.Point(245, 29); this.cbWatermark.Name = "cbWatermark"; - this.cbWatermark.Size = new System.Drawing.Size(132, 24); + this.cbWatermark.Size = new System.Drawing.Size(100, 21); this.cbWatermark.TabIndex = 4; this.cbWatermark.Text = "(None)"; // // tbRevDate // this.tbRevDate.AcceptsReturn = true; - this.tbRevDate.Location = new System.Drawing.Point(327, 4); - this.tbRevDate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tbRevDate.Location = new System.Drawing.Point(245, 3); this.tbRevDate.Name = "tbRevDate"; - this.tbRevDate.Size = new System.Drawing.Size(132, 22); + this.tbRevDate.Size = new System.Drawing.Size(100, 20); this.tbRevDate.TabIndex = 3; this.tbRevDate.Text = "07/27/10"; // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(240, 7); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label2.Location = new System.Drawing.Point(180, 6); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(38, 17); + this.label2.Size = new System.Drawing.Size(30, 13); this.label2.TabIndex = 2; this.label2.Text = "Date"; // // tbRev // - this.tbRev.Location = new System.Drawing.Point(95, 4); - this.tbRev.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tbRev.Location = new System.Drawing.Point(71, 3); this.tbRev.Name = "tbRev"; - this.tbRev.Size = new System.Drawing.Size(132, 22); + this.tbRev.Size = new System.Drawing.Size(100, 20); this.tbRev.TabIndex = 1; this.tbRev.Text = "25"; // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(8, 7); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Location = new System.Drawing.Point(6, 6); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(33, 17); + this.label1.Size = new System.Drawing.Size(27, 13); this.label1.TabIndex = 0; this.label1.Text = "Rev"; // @@ -227,25 +224,22 @@ namespace PrintMSWord // this.lbProcs.Dock = System.Windows.Forms.DockStyle.Fill; this.lbProcs.FormattingEnabled = true; - this.lbProcs.ItemHeight = 16; - this.lbProcs.Location = new System.Drawing.Point(0, 28); - this.lbProcs.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.lbProcs.Location = new System.Drawing.Point(0, 24); this.lbProcs.Name = "lbProcs"; - this.lbProcs.Size = new System.Drawing.Size(646, 356); + this.lbProcs.Size = new System.Drawing.Size(485, 290); this.lbProcs.TabIndex = 3; this.lbProcs.DoubleClick += new System.EventHandler(this.lbProcs_DoubleClick); // // frmPrintMSWord // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1125, 415); + this.ClientSize = new System.Drawing.Size(844, 337); this.Controls.Add(this.lbProcs); this.Controls.Add(this.panel1); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.menuStrip1); this.MainMenuStrip = this.menuStrip1; - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "frmPrintMSWord"; this.Text = "PrintMSWord"; this.Load += new System.EventHandler(this.frmPrintMSWord_Load); @@ -279,5 +273,6 @@ namespace PrintMSWord private System.Windows.Forms.TextBox tbTimings; private DevComponents.DotNetBar.Controls.CheckBoxX cbDebugOutput; private System.Windows.Forms.ToolStripMenuItem pDFsToolStripMenuItem; + private System.Windows.Forms.ToolStripProgressBar tspbStatus; } } \ No newline at end of file diff --git a/PROMS/VEPROMS/PrintMSWord/frmPrintMsWord.cs b/PROMS/VEPROMS/PrintMSWord/frmPrintMsWord.cs index 9cc50a33..2e1a0f3b 100644 --- a/PROMS/VEPROMS/PrintMSWord/frmPrintMsWord.cs +++ b/PROMS/VEPROMS/PrintMSWord/frmPrintMsWord.cs @@ -24,6 +24,28 @@ namespace PrintMSWord get { return tsslStatus.Text; } set { tsslStatus.Text = value; Application.DoEvents(); } } + private DateTime _TimerStart; + public DateTime TimerStart + { + get { return _TimerStart; } + set { _TimerStart = value; } + } + private string _ProcedureNumber; + public string ProcedureNumber + { + get { return _ProcedureNumber; } + set { _ProcedureNumber = value; } + } + public string MyTimerStatus + { + get { return tsslStatus.Text; } + set { + TimeSpan ts = DateTime.Now - _TimerStart; + DateTime dt = new DateTime(ts.Ticks); + tsslStatus.Text = string.Format("{0:HH:mm:ss.fff} {1} {2}",dt,ProcedureNumber,value); + Application.DoEvents(); + } + } private DocVersionInfo GetDocVersionWithContent() { DocVersionInfoList dvList = DocVersionInfoList.Get(); @@ -43,13 +65,13 @@ namespace PrintMSWord } private void CreatePDF() { + TimerStart = DateTime.Now; ProcedureInfo myProcedure = MyProcedure; Volian.Print.Library.Rtf2Pdf.PdfDebug = true; tbTimings.Text = ""; Cursor saveCursor = this.Cursor; this.Cursor = Cursors.WaitCursor; //ProcedureConfig.PrintWatermark pw = MyProcedure.ProcedureConfig.Print_Watermark; - CreatePDF(myProcedure,true); this.Cursor = saveCursor; } @@ -71,9 +93,9 @@ namespace PrintMSWord string pdfFile = pp.Print(@"C:\TEMP\32Bit"); DateTime tEnd = DateTime.Now; _ElapsedTime.Add(PromsPrinterStatusType.Total, DateTime.Now - tStart); - MyStatus = pdfFile + " created."; + MyTimerStatus = pdfFile + " created."; ShowElapsedTime(); - MyStatus = string.Format("{0} created in {1:0.} milliseconds", pdfFile, (TimeSpan.FromTicks(tEnd.Ticks - tStart.Ticks).TotalMilliseconds)); + //MyStatus = string.Format("{0} created in {1:0.} milliseconds", pdfFile, (TimeSpan.FromTicks(tEnd.Ticks - tStart.Ticks).TotalMilliseconds)); } private void ShowElapsedTime() { @@ -108,15 +130,25 @@ namespace PrintMSWord private void pDFsToolStripMenuItem_Click(object sender, EventArgs e) { - + TimerStart = DateTime.Now; Volian.Print.Library.Rtf2Pdf.PdfDebug = true; tbTimings.Text = ""; Cursor saveCursor = this.Cursor; this.Cursor = Cursors.WaitCursor; //ProcedureConfig.PrintWatermark pw = MyProcedure.ProcedureConfig.Print_Watermark; ItemInfoList myItems = lbProcs.DataSource as ItemInfoList; - foreach(ItemInfo myItem in myItems) - CreatePDF(myItem.MyProcedure,false); + tspbStatus.Maximum = myItems.Count; + tspbStatus.Value = 0; + tspbStatus.Visible = true; + foreach (ItemInfo myItem in myItems) + { + ProcedureNumber = myItem.DisplayNumber; + if (tspbStatus != null) tspbStatus.Value++; + CreatePDF(myItem.MyProcedure, false); + } + ProcedureNumber = ""; + MyTimerStatus = "Processing Complete"; + tspbStatus.Visible = false; this.Cursor = saveCursor; } } diff --git a/PROMS/Volian.Base.Library/VlnSettings.cs b/PROMS/Volian.Base.Library/VlnSettings.cs index 7dfdf6a0..c6048829 100644 --- a/PROMS/Volian.Base.Library/VlnSettings.cs +++ b/PROMS/Volian.Base.Library/VlnSettings.cs @@ -41,7 +41,7 @@ namespace Volian.Base.Library } } // used for Debug mode (at least for now) - // this is where the PDF 16-bit VE-PROMS output is placed and merge (via layers) into the PROMS 2010 PDF Output + // this is where the PDF 16-bit VE-PROMS output is placed and merged (via layers) into the PROMS 2010 PDF Output private static string _OldPDFFolder = @"C:\Temp\16bit"; public static string OldPDFFolder diff --git a/PROMS/Volian.Controls.Library/DisplayRO.cs b/PROMS/Volian.Controls.Library/DisplayRO.cs index af59da4b..965f35a2 100644 --- a/PROMS/Volian.Controls.Library/DisplayRO.cs +++ b/PROMS/Volian.Controls.Library/DisplayRO.cs @@ -297,12 +297,36 @@ namespace Volian.Controls.Library { tmp = new TreeNode(chld[i].title); tmp.Tag = chld[i]; - tn.Nodes.Add(tmp); + int index = FindIndex(tn.Nodes, tmp.Text); + tn.Nodes.Insert(index,tmp); } } } ProgressBar_Clear(); } + private int FindIndex(TreeNodeCollection nodes, string value) + { + int index = 0; + foreach (TreeNode node in nodes) + { + if (GreaterValue(node.Text, value)) return index; + index++; + } + return index; + } + private static Regex _RegExGetNumber = new Regex(@"^ *[+-]?[.,0-9]+(E[+-]?[0-9]+)?"); + private bool GreaterValue(string value1, string value2) + { + Match match1 = _RegExGetNumber.Match(value1); + Match match2 = _RegExGetNumber.Match(value2); + if (match1.Success && match2.Success) // Compare the numeric value + { + double dbl1 = double.Parse(match1.ToString()); + double dbl2 = double.Parse(match2.ToString()); + return dbl1 > dbl2; + } + return String.Compare(value1, value2, true) > 0; + } private void LoadTree() { if (_MyROFST == null) return;