Added to the User Interface

Settings for Builders Group Demo
Event handler for Search Results Report and Resolution User Interface
Added code to make DataLoader and PDF generation faster
Added ToolTip Property to ItemInfo
Added code to handle "AND Range" Transitions
Changed comment
Sorts ROs by value
This commit is contained in:
Rich
2010-09-06 19:35:11 +00:00
parent 90a7a6dbc0
commit d0ec2bab6f
10 changed files with 215 additions and 63 deletions

View File

@@ -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);

View File

@@ -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; }

View File

@@ -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