Added a hidden check box which is used to generate a Continuous Action Summary

Continuous Action Summary logic
Continuous Action Summary logic – hooks for tree menu and ribbon button
This commit is contained in:
John Jenko 2015-10-23 18:10:31 +00:00
parent e30019797e
commit 17d4c2b26b
5 changed files with 514 additions and 393 deletions

File diff suppressed because it is too large Load Diff

View File

@ -110,6 +110,11 @@ namespace VEPROMS
get { return txbReviewDate.Text; }
set { txbReviewDate.Text = value; }
}
public bool CreateContinuousActionSummary
{
get { return cbxGenerateConActSum.Checked; }
set { cbxGenerateConActSum.Checked = value; }
}
public DlgPrintProcedure(DocVersionInfo dvi, bool automatic)
{
_Automatic = automatic;
@ -152,6 +157,7 @@ namespace VEPROMS
cbxOverwritePDF2.Checked = true;
gpnlDebug.Visible = Volian.Base.Library.VlnSettings.DebugMode;
cbxGeneratePlacekeeper.Checked = false;
cbxGenerateConActSum.Checked = false;
cbxGeneratePlacekeeper.Visible = oneProcedure &&
((MyProcedure.ActiveFormat.PlantFormat.FormatData.PurchaseOptions & E_PurchaseOptions.AutoPlacekeeper) == E_PurchaseOptions.AutoPlacekeeper);
}
@ -715,6 +721,9 @@ namespace VEPROMS
cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50),
cbxBlankPgsForDuplex.Checked, _AllProcedures || Automatic,Prefix,SaveLinks);
frmStatus.MakePlaceKeeper = cbxGeneratePlacekeeper.Checked;
frmStatus.MakeContinuousActionSummary = cbxGenerateConActSum.Checked;
if (Automatic && cbxGenerateConActSum.Checked)
frmStatus.OnlyShowContinuousActionSummary = true;
int profileDepth3 = ProfileTimer.Push(">>>> frmStatus");
frmStatus.ShowDialog();
ProfileTimer.Pop(profileDepth3);

View File

@ -134,9 +134,6 @@
<metadata name="docVersionConfigBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>321, 17</value>
</metadata>
<metadata name="docVersionConfigBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>321, 17</value>
</metadata>
<metadata name="DlgBrowseFolder.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>153, 17</value>
</metadata>

View File

@ -66,6 +66,15 @@ namespace VEPROMS
get { return _Prefix; }
set { _Prefix = value; }
}
// this flag is used when the Continuous Action Sumamry is printed from the tree or ribbon button
// it will prevent the temporary PDF (generated with printing - needed to get page numbers) from being displayed
// and will delete that temporary PDF file
private bool _OnlyShowContinuousActionSummary = false;
public bool OnlyShowContinuousActionSummary
{
get { return _OnlyShowContinuousActionSummary; }
set { _OnlyShowContinuousActionSummary = value; }
}
public frmPDFStatusForm(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd,string pdfFile, Point newLocation,bool insertBlankPages, bool allOrAuto, string prefix, bool saveLinks)
{
Prefix = prefix;
@ -109,6 +118,8 @@ namespace VEPROMS
{
Location = _NewLocation;
tmrRun.Enabled = true;
if (MakeContinuousActionSummary)
Text = Text.Replace("PDF", "Continuous Action Summary");
}
private string _PdfFile;
@ -120,6 +131,15 @@ namespace VEPROMS
get { return _MakePlaceKeeper; }
set { _MakePlaceKeeper = value; }
}
private bool _MakeContinuousActionSummary = false;
public bool MakeContinuousActionSummary
{
get { return _MakeContinuousActionSummary; }
set { _MakeContinuousActionSummary = value; }
}
private void tmrRun_Tick(object sender, EventArgs e)
{
tmrRun.Enabled = false;
@ -131,7 +151,7 @@ namespace VEPROMS
do
{
int profileDepth = ProfileTimer.Push(">>>> MyPromsPrinter.Print");
_PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper);
_PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper, MakeContinuousActionSummary);
ProfileTimer.Pop(profileDepth);
}
while (_PdfFile == null && MessageBox.Show("Try Again?", "PDF Creation Failed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes);
@ -174,11 +194,13 @@ namespace VEPROMS
// - requested by Calvert Cliffs
private void OpenPDFandPlacekeeper(string pdffile)
{
if ((pdffile ?? "") != "")
if ((pdffile ?? "") != "" && !OnlyShowContinuousActionSummary)
{
System.Diagnostics.Process sdp = System.Diagnostics.Process.Start(pdffile);
sdp.WaitForInputIdle();
}
if (OnlyShowContinuousActionSummary)
System.IO.File.Delete(pdffile); // remove the temporary PDF file used to create the Continuous Action Summary
if (MyPromsPrinter.MyPlacekeeper != null)
{
// The PlacekeeperDelay is a switch that can be added to the PROMS.exe shortcut
@ -188,6 +210,19 @@ namespace VEPROMS
System.Threading.Thread.Sleep(mydelay);
MyPromsPrinter.MyPlacekeeper.Visible();
}
// this will display the generated Continuous Action Summary in MS Word (starting a new instance of MS Word outside of PROMS)
if (MyPromsPrinter.MyContActSummary != null)
{
string instructions = "The Coninuous Action Summary will be opened in MS Word.\n\nYou can make modifications and copy it into a PROMS Word section.";
MessageBox.Show(instructions, "Continuous Action Summary");
// The ContActSummaryDelay is a switch that can be added to the PROMS.exe shortcut
// ex: VEPROMS.EXE /ContActSummaryDelay=2.5 will delay it 2 1/2 seconds
float delay = Volian.Base.Library.VlnSettings.GetCommandFloat("ContActSummaryDelay", 1.0f);
int mydelay = (int)(1000 * delay);
System.Threading.Thread.Sleep(mydelay);
MyPromsPrinter.MyContActSummary.Visible();
}
}
private void btnOpenFolder_Click(object sender, EventArgs e)
{

View File

@ -81,10 +81,40 @@ namespace VEPROMS
_SelectedStepTabPanel.MyStepTabRibbon.PrintRequest -= new StepTabRibbonEvent(MyStepTabRibbon_PrintRequest);
_SelectedStepTabPanel.MyStepTabRibbon.PrintRequest += new StepTabRibbonEvent(MyStepTabRibbon_PrintRequest);
_SelectedStepTabPanel.MyStepTabRibbon.ProgressBar = bottomProgBar;
_SelectedStepTabPanel.MyStepTabRibbon.ContActionSummaryRequest -= MyStepTabRibbon_ContActionSummaryRequest;
_SelectedStepTabPanel.MyStepTabRibbon.ContActionSummaryRequest += MyStepTabRibbon_ContActionSummaryRequest;
}
}
}
void MyStepTabRibbon_ContActionSummaryRequest(object sender, StepTabRibbonEventArgs args)
{
DialogResult dr = System.Windows.Forms.DialogResult.Yes;
ProcedureInfo piThis = null;
if (_CurrentItem != null) piThis = _CurrentItem.MyProcedure;
ProcedureInfo pi = args.Proc as ProcedureInfo;
if (piThis != null && pi.ItemID != piThis.ItemID) pi = piThis;
//added by jcb 20130718 to support create pdf button when multiunit and user selects a unit
pi.MyDocVersion.DocVersionConfig.SelectedSlave = pi.ProcedureConfig.SelectedSlave;
//end added by jcb 20130718
if (pi == null) return;
DlgPrintProcedure prnDlg = new DlgPrintProcedure(pi);
//added by jcb 20130718 to support create pdf button when multiunit and user selects a unit
prnDlg.SelectedSlave = pi.ProcedureConfig.SelectedSlave == 0 ? -1 : pi.ProcedureConfig.SelectedSlave;
prnDlg.MySessionInfo = MySessionInfo;
//end added by jcb 20130718
prnDlg.Automatic = true;
prnDlg.CreateContinuousActionSummary = true;
prnDlg.OpenAfterCreate = (dr == System.Windows.Forms.DialogResult.Yes);
prnDlg.Prefix = "CASTMP_"; // A temporary procedure PDF is created to grab page numbers
prnDlg.SetupForProcedure();
prnDlg.CreatePDF();
//added by jcb 20130718 to support create pdf button when multiunit and user selects a unit
pi.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
//end added by jcb 20130718
}
public DocVersionInfo SelectedDVI
{
get { return _SelectedDVI; }
@ -307,7 +337,9 @@ namespace VEPROMS
tv.PrintTransitionReport += new vlnTreeViewEvent(tv_PrintTransitionReport);
tv.ProcessingComplete += tv_ProcessingComplete;
tv.Processing += tv_Processing;
tv.CreateContinuousActionSummary += new vlnTreeViewEvent(tv_CreateContinuousActionSummary);
}
private bool _SkipRefresh = false;
public bool SkipRefresh
{
@ -511,11 +543,13 @@ namespace VEPROMS
if (pnl.ApplDisplayMode > 0)
{
pnl.MyStepTabPanel.MyStepTabRibbon.btnPdfCreate.Enabled = true;
pnl.MyStepTabPanel.MyStepTabRibbon.btnCASCreate.Enabled = true;
btnPrint.Visible = true;
}
else
{
pnl.MyStepTabPanel.MyStepTabRibbon.btnPdfCreate.Enabled = false;
pnl.MyStepTabPanel.MyStepTabRibbon.btnCASCreate.Enabled = false;
btnPrint.Visible = false;
}
//end added by jcb 20130718
@ -707,6 +741,24 @@ namespace VEPROMS
prnDlg.ShowDialog(this); // RHM 20120925 - Center dialog over PROMS window
pi.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
}
void tv_CreateContinuousActionSummary(object sender, vlnTreeEventArgs args)
{
DialogResult dr = System.Windows.Forms.DialogResult.Yes;
ProcedureInfo pi = (args.Node as VETreeNode).VEObject as ProcedureInfo;
pi.MyDocVersion.DocVersionConfig.SelectedSlave = args.UnitIndex;
if (pi == null) return;
tc.SaveCurrentEditItem(pi);
DlgPrintProcedure prnDlg = new DlgPrintProcedure(pi, true);
prnDlg.MySessionInfo = MySessionInfo;
prnDlg.SelectedSlave = args.UnitIndex;
prnDlg.Automatic = true;
prnDlg.CreateContinuousActionSummary = true;
prnDlg.OpenAfterCreate = (dr == System.Windows.Forms.DialogResult.Yes);
prnDlg.Prefix = "CASTMP_"; // prefix the temporary procedure PDF file that is generated (to grab page numbers)
prnDlg.SetupForProcedure();
prnDlg.CreatePDF();
pi.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
}
void RefreshDisplayHistory(object sender)
{
displayHistory.RefreshChangeList();
@ -1712,7 +1764,8 @@ namespace VEPROMS
private DialogResult ShowEULA()
{
string eulaFile = string.Format(@"\{0}", VlnSettings.EULAfile);
string strEULA = System.Environment.CurrentDirectory + eulaFile;
string strEULA = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + eulaFile;
//string strEULA = System.Environment.CurrentDirectory + eulaFile;
frmViewTextFile ViewFile = new frmViewTextFile(strEULA, RichTextBoxStreamType.PlainText);
ViewFile.Text = "End-User License Agreement";
ViewFile.ButtonText = "Agree";