This commit is contained in:
parent
cf2c344f37
commit
e35448535d
@ -36,11 +36,24 @@ namespace Volian.Print.Library
|
|||||||
get { return _Type; }
|
get { return _Type; }
|
||||||
set { _Type = value; }
|
set { _Type = value; }
|
||||||
}
|
}
|
||||||
|
private int _Progress = 0;
|
||||||
|
|
||||||
|
public int Progress
|
||||||
|
{
|
||||||
|
get { return _Progress; }
|
||||||
|
set { _Progress = value; }
|
||||||
|
}
|
||||||
public PromsPrintStatusArgs(string myStatus, PromsPrinterStatusType type)
|
public PromsPrintStatusArgs(string myStatus, PromsPrinterStatusType type)
|
||||||
{
|
{
|
||||||
_MyStatus = myStatus;
|
_MyStatus = myStatus;
|
||||||
_Type = type;
|
_Type = type;
|
||||||
}
|
}
|
||||||
|
public PromsPrintStatusArgs(string myStatus, PromsPrinterStatusType type, int progress)
|
||||||
|
{
|
||||||
|
_MyStatus = myStatus;
|
||||||
|
_Type = type;
|
||||||
|
_Progress = progress;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public enum PromsPrinterStatusType
|
public enum PromsPrinterStatusType
|
||||||
{
|
{
|
||||||
@ -65,7 +78,9 @@ namespace Volian.Print.Library
|
|||||||
SetPageEvent,
|
SetPageEvent,
|
||||||
GetSection,
|
GetSection,
|
||||||
Before,
|
Before,
|
||||||
BuildStep
|
BuildStep,
|
||||||
|
Progress,
|
||||||
|
ProgressSetup
|
||||||
}
|
}
|
||||||
public class PromsPrinter
|
public class PromsPrinter
|
||||||
{
|
{
|
||||||
@ -79,6 +94,10 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
OnStatusChanged(this, new PromsPrintStatusArgs(myStatus, type));
|
OnStatusChanged(this, new PromsPrintStatusArgs(myStatus, type));
|
||||||
}
|
}
|
||||||
|
private void OnStatusChanged(string myStatus, PromsPrinterStatusType type, int progress)
|
||||||
|
{
|
||||||
|
OnStatusChanged(this, new PromsPrintStatusArgs(myStatus, type, progress));
|
||||||
|
}
|
||||||
private string _Rev;
|
private string _Rev;
|
||||||
private string _RevDate;
|
private string _RevDate;
|
||||||
private ItemInfo _MyItem;
|
private ItemInfo _MyItem;
|
||||||
@ -95,7 +114,14 @@ namespace Volian.Print.Library
|
|||||||
get { return _BackgroundFolder; }
|
get { return _BackgroundFolder; }
|
||||||
set { _BackgroundFolder = value; }
|
set { _BackgroundFolder = value; }
|
||||||
}
|
}
|
||||||
public PromsPrinter(ItemInfo myItem, string rev, string revDate, string watermark, bool debugOutput, string backgroundFolder)
|
private bool _OpenPDF;
|
||||||
|
|
||||||
|
public bool OpenPDF
|
||||||
|
{
|
||||||
|
get { return _OpenPDF; }
|
||||||
|
set { _OpenPDF = value; }
|
||||||
|
}
|
||||||
|
public PromsPrinter(ItemInfo myItem, string rev, string revDate, string watermark, bool debugOutput, string backgroundFolder,bool openPDF)
|
||||||
{
|
{
|
||||||
_MyItem = myItem;
|
_MyItem = myItem;
|
||||||
_Rev = rev;
|
_Rev = rev;
|
||||||
@ -103,6 +129,7 @@ namespace Volian.Print.Library
|
|||||||
_Watermark = watermark;
|
_Watermark = watermark;
|
||||||
_DebugOutput = debugOutput;
|
_DebugOutput = debugOutput;
|
||||||
_BackgroundFolder = backgroundFolder;
|
_BackgroundFolder = backgroundFolder;
|
||||||
|
_OpenPDF = openPDF;
|
||||||
}
|
}
|
||||||
public string Print(string pdfFolder)
|
public string Print(string pdfFolder)
|
||||||
{
|
{
|
||||||
@ -153,7 +180,8 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
cb.PdfDocument.Close();
|
cb.PdfDocument.Close();
|
||||||
OnStatusChanged("CloseDocument", PromsPrinterStatusType.CloseDocument);
|
OnStatusChanged("CloseDocument", PromsPrinterStatusType.CloseDocument);
|
||||||
System.Diagnostics.Process.Start(fileName);
|
if (OpenPDF)
|
||||||
|
System.Diagnostics.Process.Start(fileName);
|
||||||
OnStatusChanged("OpenPDF", PromsPrinterStatusType.OpenPDF);
|
OnStatusChanged("OpenPDF", PromsPrinterStatusType.OpenPDF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,8 +228,11 @@ namespace Volian.Print.Library
|
|||||||
OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before);
|
OnStatusChanged("Before NewPage", PromsPrinterStatusType.Before);
|
||||||
cb.PdfDocument.NewPage();
|
cb.PdfDocument.NewPage();
|
||||||
OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage);
|
OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage);
|
||||||
|
OnStatusChanged(myProcedure.DisplayNumber, PromsPrinterStatusType.ProgressSetup,myProcedure.Sections.Count);
|
||||||
|
int progress = 0;
|
||||||
foreach (SectionInfo mySection in myProcedure.Sections)
|
foreach (SectionInfo mySection in myProcedure.Sections)
|
||||||
{
|
{
|
||||||
|
OnStatusChanged((mySection.DisplayNumber??"") == "" ? mySection.DisplayText : mySection.DisplayNumber, PromsPrinterStatusType.Progress, progress++);
|
||||||
// Set up Helper for the particular Section
|
// Set up Helper for the particular Section
|
||||||
if (_MyHelper == null)
|
if (_MyHelper == null)
|
||||||
{
|
{
|
||||||
@ -301,6 +332,7 @@ namespace Volian.Print.Library
|
|||||||
cb.PdfDocument.NewPage();
|
cb.PdfDocument.NewPage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
OnStatusChanged(myProcedure.DisplayNumber + " PDF Creation Completed", PromsPrinterStatusType.Progress, progress);
|
||||||
CloseDocument(cb, outputFileName);
|
CloseDocument(cb, outputFileName);
|
||||||
// Return the fileName;
|
// Return the fileName;
|
||||||
return outputFileName;
|
return outputFileName;
|
||||||
@ -342,12 +374,12 @@ namespace Volian.Print.Library
|
|||||||
|
|
||||||
// if there is not overridden data on the docversion, prompt user...
|
// if there is not overridden data on the docversion, prompt user...
|
||||||
ChangeBarData changeBarData = myItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData;
|
ChangeBarData changeBarData = myItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData;
|
||||||
if (docverConfig == null || docverConfig.Print_ChangeBar == DocVersionConfig.PrintChangeBar.SelectBeforePrinting)
|
if (docverConfig == null || docverConfig.Print_ChangeBar == PrintChangeBar.SelectBeforePrinting)
|
||||||
{
|
{
|
||||||
// use these for now, i.e. this is what user would have selected from dialog.
|
// use these for now, i.e. this is what user would have selected from dialog.
|
||||||
cbd.MyChangeBarType = DocVersionConfig.PrintChangeBar.WithDefault;
|
cbd.MyChangeBarType = PrintChangeBar.WithDefault;
|
||||||
cbd.MyChangeBarLoc = DocVersionConfig.PrintChangeBarLoc.OutsideBox;
|
cbd.MyChangeBarLoc = PrintChangeBarLoc.OutsideBox;
|
||||||
cbd.MyChangeBarText = DocVersionConfig.PrintChangeBarText.None;
|
cbd.MyChangeBarText = PrintChangeBarText.None;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -355,21 +387,21 @@ namespace Volian.Print.Library
|
|||||||
cbd.MyChangeBarLoc = docverConfig.Print_ChangeBarLoc;
|
cbd.MyChangeBarLoc = docverConfig.Print_ChangeBarLoc;
|
||||||
cbd.MyChangeBarText = docverConfig.Print_ChangeBarText;
|
cbd.MyChangeBarText = docverConfig.Print_ChangeBarText;
|
||||||
}
|
}
|
||||||
if (cbd.MyChangeBarType == DocVersionConfig.PrintChangeBar.WithDefault) // get data from format
|
if (cbd.MyChangeBarType == PrintChangeBar.WithDefault) // get data from format
|
||||||
{
|
{
|
||||||
cbd.MyChangeBarText = changeBarData.ChangeBarMessage == "ChgID" ? DocVersionConfig.PrintChangeBarText.ChgID :
|
cbd.MyChangeBarText = changeBarData.ChangeBarMessage == "ChgID" ? PrintChangeBarText.ChgID :
|
||||||
changeBarData.ChangeBarMessage == "DateAndChgID" ? DocVersionConfig.PrintChangeBarText.DateChgID :
|
changeBarData.ChangeBarMessage == "DateAndChgID" ? PrintChangeBarText.DateChgID :
|
||||||
changeBarData.ChangeBarMessage == "None" ? DocVersionConfig.PrintChangeBarText.None :
|
changeBarData.ChangeBarMessage == "None" ? PrintChangeBarText.None :
|
||||||
changeBarData.ChangeBarMessage == "RevNum" ? DocVersionConfig.PrintChangeBarText.RevNum : DocVersionConfig.PrintChangeBarText.UserDef;
|
changeBarData.ChangeBarMessage == "RevNum" ? PrintChangeBarText.RevNum : PrintChangeBarText.UserDef;
|
||||||
}
|
}
|
||||||
if (cbd.MyChangeBarType != DocVersionConfig.PrintChangeBar.Without)
|
if (cbd.MyChangeBarType != PrintChangeBar.Without)
|
||||||
{
|
{
|
||||||
// if the format has the absolutefixedchangecolumn format flag, then always use the fixedchangecolumn from the
|
// if the format has the absolutefixedchangecolumn format flag, then always use the fixedchangecolumn from the
|
||||||
// format, otherwise, use the default column based on the selected location, stored in the base format.
|
// format, otherwise, use the default column based on the selected location, stored in the base format.
|
||||||
cbd.MyChangeBarColumn = (changeBarData.AbsoluteFixedChangeColumn) ?
|
cbd.MyChangeBarColumn = (changeBarData.AbsoluteFixedChangeColumn) ?
|
||||||
(int)changeBarData.FixedChangeColumn :
|
(int)changeBarData.FixedChangeColumn :
|
||||||
System.Convert.ToInt32(changeBarData.DefaultCBLoc.Split(" ".ToCharArray())[System.Convert.ToInt32(cbd.MyChangeBarLoc)]);
|
System.Convert.ToInt32(changeBarData.DefaultCBLoc.Split(" ".ToCharArray())[System.Convert.ToInt32(cbd.MyChangeBarLoc)]);
|
||||||
if (cbd.MyChangeBarText == DocVersionConfig.PrintChangeBarText.UserDef)
|
if (cbd.MyChangeBarText == PrintChangeBarText.UserDef)
|
||||||
cbd.MyChangeBarMessage = docverConfig.Print_UserCBMess1 + @"\n" + docverConfig.Print_UserCBMess2;
|
cbd.MyChangeBarMessage = docverConfig.Print_UserCBMess1 + @"\n" + docverConfig.Print_UserCBMess2;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user