VEPROMS_UI / remove BouncyCastle

This commit is contained in:
2026-08-21 06:11:06 -04:00
parent 23a296df86
commit 0c3e4bb3e9
41 changed files with 2298 additions and 4704 deletions
+100 -239
View File
@@ -1,29 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using VEPROMS.CSLA.Library;
using Volian.Print.Library;
//using Volian.Controls.Library;
using Volian.Base.Library;
using JR.Utils.GUI.Forms;
using System.Linq;
namespace VEPROMS
{
public partial class DlgPrintProcedure : DevComponents.DotNetBar.Office2007Form
{
public bool SaveLinks
{
get
{
return swtbtnPDFLinks.Value;
}
}
public int RemoveTrailingHardReturnsAndManualPageBreaks
public bool SaveLinks => swtbtnPDFLinks.Value;
public int RemoveTrailingHardReturnsAndManualPageBreaks
{
get
{
@@ -36,38 +28,19 @@ namespace VEPROMS
return 3;
}
}
private string _Prefix = ""; // RHM20150506 Multiline ItemID TextBox
public string Prefix
{
get { return _Prefix; }
set { _Prefix = value; }
}
public bool OpenAfterCreate // RHM20150506 Multiline ItemID TextBox
// RHM20150506 Multiline ItemID TextBox
public string Prefix { get; set; } = "";
public bool OpenAfterCreate // RHM20150506 Multiline ItemID TextBox
{
get { return cbxOpenAfterCreate2.Checked; }
set { cbxOpenAfterCreate2.Checked = value; }
}
private SessionInfo _MySessionInfo;
public SessionInfo MySessionInfo
{
get { return _MySessionInfo; }
set { _MySessionInfo = value; }
}
private bool _Automatic;
public bool Automatic
{
get { return _Automatic; }
set { _Automatic = value; }
}
private int _prtSectID = -1;
public int PrtSectID
{
get { return _prtSectID; }
set { _prtSectID = value; }
}
private bool _OverwritePDF;
public bool OverwritePDF
public SessionInfo MySessionInfo { get; set; }
public bool Automatic { get; set; }
public int PrtSectID { get; set; } = -1;
public bool OverwritePDF
{
get { return cbxOverwritePDF2.Checked; }
set { cbxOverwritePDF2.Checked = value; }
@@ -85,18 +58,17 @@ namespace VEPROMS
swtbtnPDFdtPrefixSuffix.Value = swtbtnPDFdtPrefixSuffix.Enabled = _AllowDateTimePrefixSuffix;
}
}
private DateTime _PrefixSuffixDTS = DateTime.Now; // C2018-033 date/time used for the date/time PDF file prefix and suffix
private readonly DateTime _PrefixSuffixDTS = DateTime.Now; // C2018-033 date/time used for the date/time PDF file prefix and suffix
private bool _DateTimePrefixSuffixPrintingAllProcedures = true; // C2018-033 to control adding the Date/Time Prefix/Suffix to PFD name when printing All procedures
private bool _IncludeWordSecTextInMetafile = true; // C2018-023 so that we can turn off including Word attachment text in metafile
private void RunAutomatic()
{
cbxDebugPagination.Checked = true;
cbxDebugText.Checked = true;
cbxMetaFile.Checked = true; // C2018-004 create meta file for baseline compares
cbxMetaFile.Checked = true; // C2018-004 create meta file for baseline compares
_IncludeWordSecTextInMetafile = true;
Application.DoEvents();
string[] parameters = System.Environment.CommandLine.Split(" ".ToCharArray());
bool ranAuto = false;
foreach (string parameter in parameters)
{
if (parameter.ToUpper() == "/NT")
@@ -111,11 +83,11 @@ namespace VEPROMS
_IncludeWordSecTextInMetafile = false; // C2018-023 turn off putting Word attachment text in the meta file for baseline compares
}
CreatePDFs();
this.Close();
Close();
}
private DocVersionInfo _DocVersionInfo = null;
private bool _AllProcedures;
private DocVersionConfig _DocVersionConfig;
private readonly DocVersionInfo _DocVersionInfo = null;
private readonly bool _AllProcedures;
private readonly DocVersionConfig _DocVersionConfig;
public string RevNum
{
get { return txbRevNum.Text; }
@@ -143,11 +115,8 @@ namespace VEPROMS
return RevNum + "/" + RevDate;
}
}
public string ProcNum
{
get { return MyProcedure.DisplayNumber; }
}
public string PDFPath
public string ProcNum => MyProcedure.DisplayNumber;
public string PDFPath
{
get {// B2018-069 Revert to Temporary for Baseline testing
if (PromsPrinter.BaselineTesting)
@@ -179,7 +148,7 @@ namespace VEPROMS
private bool _CreateButtonClicked = false; // B2020-062 control the toggle of date/time prefix/suffix on pdf file name
public DlgPrintProcedure(DocVersionInfo dvi, bool automatic)
{
_Automatic = automatic;
Automatic = automatic;
InitializeComponent();
_AllProcedures = true;
_DocVersionConfig = dvi.DocVersionConfig;
@@ -201,14 +170,12 @@ namespace VEPROMS
btnCreatePDF.Text = "Create PDFs";
HandleDocVersionSettings();
PrepForAllOrOne(false);
// don't open all PDFs if doing All Procedures
//cbxOpenAfterCreate2.Checked = dvi.DocVersionConfig.Print_AlwaysViewPDFAfterCreate;
// C2018-033 added the Prefix / Suffix switch to the expand Additional Settings check
expPrnSetting.Expanded = swtbtnBlankPgsForDuplex.Value || swtbtnChgBar.Value || swtbtnGeneratePlacekeeper.Value || swtbtnPDFLinks.Value || swtbtnPROMSVersion.Value || swtbtnWaterMark.Value || swtbtnPDFdtPrefixSuffix.Value;
}
public DlgPrintProcedure(DocVersionInfo dvi)
{
_Automatic = false;
Automatic = false;
InitializeComponent();
_AllProcedures = true;
_DocVersionConfig = dvi.DocVersionConfig;
@@ -249,21 +216,12 @@ namespace VEPROMS
// C2021-063 make the Generate Alarm Point List text checkbox visable in the format flag is set.
cbxAlmPtTxt.Visible = !oneProcedure && MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.ChkBoxToGeneratePointListText;
}
private string _UnitNumber;
public string UnitNumber
{
get { return _UnitNumber; }
set { _UnitNumber = value; }
}
private int _UnitIndex;
public int UnitIndex
{
get { return _UnitIndex; }
set { _UnitIndex = value; }
}
// C2018-012 - Code Cleanup - redesigned the Print Dialog to include a sliding panel and remplaced check boxes with ON/OFF switches
public DlgPrintProcedure(ProcedureInfo pi)
public string UnitNumber { get; set; }
public int UnitIndex { get; set; }
// C2018-012 - Code Cleanup - redesigned the Print Dialog to include a sliding panel and remplaced check boxes with ON/OFF switches
public DlgPrintProcedure(ProcedureInfo pi)
{
InitializeComponent();
_AllProcedures = false;
@@ -354,31 +312,9 @@ namespace VEPROMS
swtbtnWaterMark.Value = false;
else
swtbtnWaterMark.Value = true;
// Auto Duplexing on/off - Auto duplex was used only by Point Beach formats These buttons were removed from the dialog
// There was not print coding to support this format flag
//if ((_MyProcedure.ActiveParent as DocVersionInfo).ActiveFormat.PlantFormat.FormatData.PrintData.AllowDuplex)
//{
// lblAutoDuplexing.Visible = true;
// btnDuplxOff.Visible = true;
// btnDuplxOn.Visible = true;
// if (_DocVersionConfig.Print_DisableDuplex)
// btnDuplxOff.PerformClick();
// else
// btnDuplxOn.PerformClick();
//}
//else
//{
// lblAutoDuplexing.Visible = false;
// btnDuplxOff.Visible = false;
// btnDuplxOn.Visible = false;
//}
SetCompareVisibility();
// default to using OriginalPageBreaks (16bit page breaks) if App.config is set
// to true:
//cbxOrPgBrk.Visible = VlnSettings.OriginalPageBreak && VlnSettings.DebugMode;
cbxOrPgBrk.Visible = false; //per Harry
cbxOrPgBrk.Visible = false; //per Harry
cbxOrPgBrk.Checked = false;
}
@@ -416,13 +352,7 @@ namespace VEPROMS
private Timer _MyTimer;
public void SetupForProcedure() // RHM20150506 Multiline ItemID TextBox
{
if(_DocVersionInfo == null)this.Text = "Create PDF for " + ProcNum;
// get list of previous pdf files
// if no previous pdf file, then get path from frmVersionProperties
// dlgSelectFile.InitialDirectory = pdf path from frmVersionProperties
//cbxPDF.Text = string.Format(@"{0}\{1}.pdf", _PDFPath, _ProcNum);
// General 2 settings
//txbPDFLocation.Text = _PDFPath;
if(_DocVersionInfo == null)Text = "Create PDF for " + ProcNum;
BuildPDFFileName();
ProcedureConfig pc = _MyProcedure.MyConfig as ProcedureConfig;
// C2025-033 set which Child procedure is being printed used for PageStyle items
@@ -434,7 +364,7 @@ namespace VEPROMS
if (pc != null)
{
//C2021-062 use the save rev number for all procedures if set, or just use the rev number in the current procedure config
RevNum = (_NewRevForAllProcs == null) ? pc.Print_Rev : _NewRevForAllProcs;
RevNum = _NewRevForAllProcs ?? pc.Print_Rev;
RevDate = pc.Print_RevDate; //== null || pc.Print_RevDate=="" ? DateTime.Today : Convert.ToDateTime(pc.Print_RevDate);
ReviewDate = pc.Print_ReviewDate; // == null ? DateTime.Today : Convert.ToDateTime(pc.Print_ReviewDate);
//Now check the format flags to determine if/how the Rev string should be parsed.
@@ -498,11 +428,6 @@ namespace VEPROMS
else
swtbtnWaterMark.Value = false; // set to None at folder level so set Watermark switch to the off position
//ppCmbxChgBarPos.DataSource = EnumDetail<PrintChangeBarLoc>.Details();
//ppCmbxChgBarPos.DisplayMember = "Description";
//ppCmbxChgBarPos.ValueMember = "EValue";
//ppCmbxChgBarPos.SelectedIndex = (int)MyProcedure.MyDocVersion.DocVersionConfig.Print_ChangeBarLoc;
ppCmbxChgBarTxtType.DataSource = EnumDetail<PrintChangeBarText>.Details();
ppCmbxChgBarTxtType.DisplayMember = "Description";
ppCmbxChgBarTxtType.ValueMember = "EValue";
@@ -515,7 +440,7 @@ namespace VEPROMS
bool usesRevDate = _MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate || _MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash;
if (_MyProcedure.Sections != null)
{
foreach (SectionInfo mysection in _MyProcedure.Sections)
foreach (SectionInfo mysection in _MyProcedure.Sections.OfType<SectionInfo>())
hasReviewDate |= mysection.ActiveFormat.PlantFormat.HasPageListToken("{REVIEWDATE}");
}
// Only the New HLP format and the MYA format use this
@@ -535,9 +460,8 @@ namespace VEPROMS
if (MyProcedure == null) return;
string PDFFilePrefix = _DocVersionConfig.Print_PDFFilePrefix;
string PDFFileSuffix = _DocVersionConfig.Print_PDFFileSuffix;
string PDFFileName = "";
PDFDTPrefix dtPre = _DocVersionConfig.Print_PDFdtFilePrefix;
PDFDTSuffix dtSuf = _DocVersionConfig.Print_PDFdtFileSuffix;
PDFDTPrefix dtPre = _DocVersionConfig.Print_PDFdtFilePrefix;
PDFDTSuffix dtSuf = _DocVersionConfig.Print_PDFdtFileSuffix;
if (dtPre != PDFDTPrefix.None) PDFFilePrefix = ""; // incase user entered prefix text but then selected a date/time (in working draft properties)
if (dtSuf != PDFDTSuffix.None) PDFFileSuffix = ""; // incase user entered suffix text but then selected a date/time (in working draft properties)
// B2020-062 control the toggle of date/time prefix/suffix on pdf file name
@@ -556,19 +480,17 @@ namespace VEPROMS
if (dtSuf != PDFDTSuffix.None)
PDFFileSuffix = "_" + (_PrefixSuffixDTS.ToString(dtSuf.ToString())).Replace("__", " ").Replace("_", "-");
}
if (ProcNum == string.Empty)
//txbPDFName.Text = this.UnitNumber + ".pdf";
PDFFileName = this.UnitNumber;
else
//txbPDFName.Text = string.Format("{0}.pdf", _MyProcedure.PDFNumber);
PDFFileName = string.Format("{0}", _MyProcedure.PDFNumber);
//if (txbPDFName.Text.StartsWith("*"))
// txbPDFName.Text = txbPDFName.Text.Replace("*", this.UnitNumber);
if ((PDFFileName ?? "") == "") PDFFileName = "NoProcNumber";
string PDFFileName;
if (ProcNum == string.Empty)
PDFFileName = UnitNumber;
else
PDFFileName = string.Format("{0}", _MyProcedure.PDFNumber);
if ((PDFFileName ?? "") == "") PDFFileName = "NoProcNumber";
if (PDFFileName.StartsWith("*"))
PDFFileName = PDFFileName.Replace("*", this.UnitNumber);
PDFFileName = PDFFileName.Replace("*", UnitNumber);
if (PDFFileName.Contains("?")) PDFFileName = PDFFileName.Replace("?", "_"); // for wcn sys/BM-2xxA??, etc
txbPDFName.Text = PDFFilePrefix + PDFFileName + PDFFileSuffix + ".pdf";
txbPDFName.Text = $"{PDFFilePrefix}{PDFFileName}{PDFFileSuffix}.pdf";
}
// C2018-033 Enable/disable the switch to control whether to add Prefix and/or Suffix to PDF file name
@@ -585,12 +507,9 @@ namespace VEPROMS
swtbtnPDFdtPrefixSuffix.Enabled = hasPrefixSuffix;
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnCancel_Click(object sender, EventArgs e) => Close();
private void swtbtnChgBar_ValueChanged(object sender, EventArgs e)
private void swtbtnChgBar_ValueChanged(object sender, EventArgs e)
{
// C2019-031 - disable the override change bar grouping when default change bar is set to format default or no change bar
cbxOvrrideDefChgBars.Checked = false; // uncheck the override change bar check box inside the grouping
@@ -714,7 +633,7 @@ namespace VEPROMS
StringBuilder sb = new StringBuilder();
if (MySessionInfo != null)
{
foreach (ProcedureInfo myProc in _DocVersionInfo.Procedures)
foreach (ProcedureInfo myProc in _DocVersionInfo.Procedures.OfType<ProcedureInfo>())
{
string message = string.Empty;
if (!MySessionInfo.CanCheckOutItem(myProc.ItemID, CheckOutType.Procedure, ref message))
@@ -742,15 +661,14 @@ namespace VEPROMS
pbPDFsStatus.Maximum = n;
pbPDFsStatus.Visible = true;
VlnSvgPageHelper.CountInApplProcs = 1; // B2021-127: BNPPalr - Auto set of serial #, skip Front Matter as per PAL 11/1/21 (set to 1 not 0)
this.Text = string.Format("Processing {0}", _DocVersionInfo.MyFolder.Name);
foreach (ProcedureInfo myProc in _DocVersionInfo.Procedures)
Text = string.Format("Processing {0}", _DocVersionInfo.MyFolder.Name);
foreach (ProcedureInfo myProc in _DocVersionInfo.Procedures.OfType<ProcedureInfo>())
{
string locpdfname = null; // get pdf file name for later merge code
MyProcedure = myProc;
// C2021-019: Override Watermark Text, 'waterMarkText' will have whatever watermark text should be printed
ProcedureConfig procConfig = MyProcedure.MyConfig as ProcedureConfig;
string waterMarkTextOverride = "";
if (procConfig != null) waterMarkTextOverride = procConfig.GetValue("PSI", "WATERMARKOVERRIDE");
// C2021-019: Override Watermark Text, 'waterMarkText' will have whatever watermark text should be printed
string waterMarkTextOverride = "";
if (MyProcedure.MyConfig is ProcedureConfig procConfig) waterMarkTextOverride = procConfig.GetValue("PSI", "WATERMARKOVERRIDE");
// C2020-002 paper size is now set in the format files - default is Letter
Volian.Print.Library.Rtf2Pdf.PaperSize = myProc.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize;
if (myProc.Sections != null)
@@ -772,13 +690,6 @@ namespace VEPROMS
pbPDFsStatus.TextVisible = true;
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
pbPDFsStatus.Value = i;
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
// B2021-102 we now get this information in frmPDFStatusForm()
//MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
// C2018-015 add the procedure tree path and the procedure number and title to the meta file
//if (BaselineMetaFile.IsOpen && i == 1) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
//if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
string myPDFPath = GetMultiunitPDFPath();
_MergedPdfPath = myPDFPath; // If Slave, need its subdirectory/unit path for merging
@@ -814,14 +725,7 @@ namespace VEPROMS
pbPDFsStatus.TextVisible = true;
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
pbPDFsStatus.Value = i;
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
// B2021-102 we now get this information in frmPDFStatusForm()
//MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
// C2018-015 add the procedure tree path and the procedure number and title to the meta file
//if (BaselineMetaFile.IsOpen && i == 1) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
//if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
// B2016-249 Output Procedure to folder associated with Parent Child
// B2021-102 put in the using for better memory management
@@ -850,18 +754,9 @@ namespace VEPROMS
pbPDFsStatus.TextVisible = true;
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
pbPDFsStatus.Value = i;
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
int profileDepth1 = ProfileTimer.Push(">>>> GetItemAndChildren");
// B2021-102 we now get this information in frmPDFStatusForm()
//if (MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier || MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier)
// MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
//else
// MyProcedure = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID);
//// C2018-015 add the procedure tree path and the procedure number and title to the meta file
//if (BaselineMetaFile.IsOpen && i == 1) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
//if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
ProfileTimer.Pop(profileDepth1);
// B2021-102 put in the using for better memory management
// B2016-249 Output Procedure to folder associated with Parent Child
@@ -934,12 +829,12 @@ namespace VEPROMS
private void CreateDebugFiles()
{
if (cbxDebugPagination.Checked)
Volian.Base.Library.DebugPagination.Open(PDFPath + "\\DebugPagination.txt"); // RHM 20120925 Corrected spelling
Volian.Base.Library.DebugPagination.Open($"{PDFPath}\\DebugPagination.txt"); // RHM 20120925 Corrected spelling
if (cbxDebugText.Checked)
Volian.Base.Library.DebugText.Open(PDFPath + "\\DebugText.txt");
Volian.Base.Library.DebugText.Open($"{PDFPath}\\DebugText.txt");
if (cbxMetaFile.Checked) // C2018-004 create meta file for baseline compares
{
Volian.Base.Library.BaselineMetaFile.Open(PDFPath + "\\DebugMeta.txt");
Volian.Base.Library.BaselineMetaFile.Open($"{PDFPath}\\DebugMeta.txt");
// C2018-015 add the PROMS Version, SQL Server, and Database to top of the meta file
Volian.Base.Library.BaselineMetaFile.WriteLine("!! Ver {0} {1} {2}", AboutVEPROMS.PROMSVersion, AboutVEPROMS.SQLServerName, AboutVEPROMS.DatabaseName);
// C2018-023 set as to whether we are going to include the Word attment text in the baseline metafile
@@ -975,7 +870,7 @@ namespace VEPROMS
if (MyProcedure.MyDocVersion.MultiUnitCount > 1)
{
VlnSvgPageHelper.CountInApplProcs = 1;
foreach (ProcedureInfo pi in MyProcedure.MyDocVersion.Procedures)
foreach (ProcedureInfo pi in MyProcedure.MyDocVersion.Procedures.OfType<ProcedureInfo>())
{
if (pi.ItemID == MyProcedure.ItemID) break;
bool includeProc = pi.ApplInclude(SelectedSlave);
@@ -991,24 +886,14 @@ namespace VEPROMS
string waterMarkText = (swtbtnWaterMark.Value) ? cbxWaterMark.Text : "None" ; // B2018-124 use text of watermark form drop down list instead of enum value
string watermarkColor = "Blue"; // this is the default watermark color
frmPDFStatusForm.SetUnitWatermark(MyProcedure, ref waterMarkText, ref watermarkColor); //C2022-004 Unit Designator Watermark
ProcedureConfig procConfig = MyProcedure.MyConfig as ProcedureConfig;
string waterMarkTextOverride = "";
if (procConfig != null) waterMarkTextOverride = procConfig.GetValue("PSI", "WATERMARKOVERRIDE"); // C2021-019: override watermark text
string waterMarkTextOverride = "";
if (MyProcedure.MyConfig is ProcedureConfig procConfig) waterMarkTextOverride = procConfig.GetValue("PSI", "WATERMARKOVERRIDE"); // C2021-019: override watermark text
if (swtbtnWaterMark.Value && waterMarkTextOverride != null && waterMarkTextOverride != "") waterMarkText = waterMarkTextOverride;
// Determine change bar settings. First get from config & then see if override from dialog.
// Also check that format allows override.
ChangeBarDefinition cbd = DetermineChangeBarSettings();
int profileDepth2 = ProfileTimer.Push(">>>> CreatePdf.GetItemAndChildren");
// B2021-088 moved this if/else to frmPDFStatusForm() so that the Approval logic will have access to this logic
//if (MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave > 0 || MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier || MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier)
// MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
//else
// MyProcedure = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID);
// C2018-015 add the procedure tree path and the procedure number and title to the meta file
//if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a"," | "));
//if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
// B2022-088: Find Doc Ro button not working in Word Sections
// Initialize Print Cache
MSWordToPDF.RoPrintCache = new Dictionary<string, ROFSTLookup.rochild>();
@@ -1045,7 +930,7 @@ namespace VEPROMS
MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
MyProcedure.SelectedChildToPrint = 0; // B2023-035 reset
this.Close();
Close();
ShowDebugFiles();
ProfileTimer.Pop(profileDepth);
ProfileTimer.ShowTimerTable();
@@ -1121,22 +1006,19 @@ namespace VEPROMS
DoCreatePDF();
}
public void QPCreatePDF()
{
DoCreatePDF();
}
public void QPCreatePDF() => DoCreatePDF();
private void DoCreatePDF()
private void DoCreatePDF()
{
if (_AllProcedures)
{
this.Cursor = Cursors.WaitCursor;
Cursor = Cursors.WaitCursor;
DateTime dtStart = DateTime.Now;
_MultiunitPdfLocation = cbxMultiunitPdfLocation.SelectedItem.ToString();
PromsPrinter.ClearTransPageNumProblems();
CreatePDFs();
PromsPrinter.ReportTransPageNumProblems();
this.Cursor = Cursors.Default;
Cursor = Cursors.Default;
if (_MergedPfd == null)
{
if (VlnSettings.DebugMode)
@@ -1149,7 +1031,7 @@ namespace VEPROMS
{
MessageBox.Show("Completed Successfully", "Print All Procedures", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
this.Close();
Close();
}
}
else
@@ -1158,14 +1040,14 @@ namespace VEPROMS
// B2017-009 If the selected item is null don't add a folder
if (cbxMultiunitPdfLocation.SelectedItem != null)
_MultiunitPdfLocation = cbxMultiunitPdfLocation.SelectedItem.ToString();
this.Cursor = Cursors.WaitCursor;
Cursor = Cursors.WaitCursor;
_CreateButtonClicked = true; // B2020-062 control the toggle of date/time prefix/suffix on pdf file name
CreatePDF();
_CreateButtonClicked = false;
this.Cursor = Cursors.Default;
Cursor = Cursors.Default;
}
}
private bool _Initializing = false;
private readonly bool _Initializing = false;
private void btnPdfLocation_Click(object sender, EventArgs e)
{
@@ -1191,12 +1073,9 @@ namespace VEPROMS
ppTxbxChangeBarUserMsgOne.Enabled = enabled;
ppTxbxChangeBarUserMsgTwo.Enabled = enabled;
}
private void cbxOvrrideDefChgBars_CheckStateChanged(object sender, EventArgs e)
{
SetCustomControls(cbxOvrrideDefChgBars.Checked);
}
private void cbxOvrrideDefChgBars_CheckStateChanged(object sender, EventArgs e) => SetCustomControls(cbxOvrrideDefChgBars.Checked);
private void rbCustom_Click(object sender, EventArgs e)
private void rbCustom_Click(object sender, EventArgs e)
{
SetCustomControls(true);
// Make Custom controls visible
@@ -1218,24 +1097,22 @@ namespace VEPROMS
// B2024-058 Add validation for Revision Date field of the Print dialog
private bool validateDate(TextBox txtDate)
{
DateTime dDate;
if (!(txtDate.Text == ""))
{
if (DateTime.TryParse(txtDate.Text, out dDate))
{
return true;
}
else
{
string txtDate2 = txtDate.Text;
string message = String.Format("Date {0} in wrong format" + System.Environment.NewLine + "Correct the revision date.", txtDate2);
string txtTitle = "Invalid Format";
MessageBox.Show(message, txtTitle);
return false;
}
}
return true;
if (!(txtDate.Text == ""))
{
if (DateTime.TryParse(txtDate.Text, out _))
{
return true;
}
else
{
string txtDate2 = txtDate.Text;
string message = String.Format("Date {0} in wrong format" + System.Environment.NewLine + "Correct the revision date.", txtDate2);
string txtTitle = "Invalid Format";
MessageBox.Show(message, txtTitle);
return false;
}
}
return true;
}
private void txbRevDate_Enter(object sender, EventArgs e)
@@ -1243,8 +1120,6 @@ namespace VEPROMS
txbDate = txbRevDate;
grpDateSelector.Text = "Select Revision Date";
grpDateSelector.Visible = calDateSelector.Visible = true;
//C2021-007 position the calendar to the current RevDate or if no RevDate, position to today's date
DateTime dDate;
// B2024-058 Add validation for Revision Date field of the Print dialog
if (!validateDate(txbDate))
{
@@ -1259,17 +1134,16 @@ namespace VEPROMS
private void txbRevDate_Leave(object sender, EventArgs e)
{
if (_Initializing) return;
if (this.ActiveControl == calDateSelector)
if (ActiveControl == calDateSelector)
{
txbRevDate.Focus(); //B2018-059 keep the calendar open until a different field on the print dialog is selected
return;
}
txbDate = null;
grpDateSelector.Visible = calDateSelector.Visible = false;
// save the RevDate to the procedure's config.
ProcedureConfig pc = MyProcedure.MyConfig as ProcedureConfig;
if (pc == null) return;
pc.Print_RevDate = txbRevDate.Text;
// save the RevDate to the procedure's config.
if (!(MyProcedure.MyConfig is ProcedureConfig pc)) return;
pc.Print_RevDate = txbRevDate.Text;
using (Item itm = Item.Get(MyProcedure.ItemID))
{
itm.MyContent.Config = MyProcedure.MyConfig.ToString();
@@ -1283,10 +1157,9 @@ namespace VEPROMS
if (_Initializing) return;
txbDate = null;
grpDateSelector.Visible = calDateSelector.Visible = false;
// save the ReviewDate to the procedure's config.
ProcedureConfig pc = MyProcedure.MyConfig as ProcedureConfig;
if (pc == null) return;
pc.Print_ReviewDate = txbReviewDate.Text;
// save the ReviewDate to the procedure's config.
if (!(MyProcedure.MyConfig is ProcedureConfig pc)) return;
pc.Print_ReviewDate = txbReviewDate.Text;
using (Item itm = Item.Get(MyProcedure.ItemID))
{
itm.MyContent.Config = MyProcedure.MyConfig.ToString();
@@ -1326,10 +1199,9 @@ namespace VEPROMS
// C2021-062 used to save rev number information when all procedures are printed or merged
private void SaveRevNumToProcedureConfig(string newrevnum)
{
// save the RevNum to the procedure's config.
ProcedureConfig pc = MyProcedure.MyConfig as ProcedureConfig;
if (pc == null) return;
pc.Print_Rev = newrevnum;
// save the RevNum to the procedure's config.
if (!(MyProcedure.MyConfig is ProcedureConfig pc)) return;
pc.Print_Rev = newrevnum;
using (Item itm = Item.Get(MyProcedure.ItemID))
{
itm.MyContent.Config = MyProcedure.MyConfig.ToString();
@@ -1341,22 +1213,16 @@ namespace VEPROMS
{
if (expPrnSetting.Expanded)
{
this.Size = new Size(this.Size.Width + (expPrnSetting.Size.Width - expPrnSetting.TitlePanel.Size.Height), this.Size.Height);
Size = new Size(Size.Width + (expPrnSetting.Size.Width - expPrnSetting.TitlePanel.Size.Height), Size.Height);
// B2018-137 set the visability of Generate Placekeeper
swtbtnGeneratePlacekeeper.Visible = lblGeneratePlacekeeper.Visible = ((MyProcedure.ActiveFormat.PlantFormat.FormatData.PurchaseOptions & E_PurchaseOptions.AutoPlacekeeper) == E_PurchaseOptions.AutoPlacekeeper);
}
//else
// this.Size = new Size(this.Size.Width-(expPrnSetting.Size.Width-expPrnSetting.TitlePanel.Size.Height), this.Size.Height);
//Refresh();
}
private void expPrnSetting_ExpandedChanging(object sender, DevComponents.DotNetBar.ExpandedChangeEventArgs e)
{
{
if (expPrnSetting.Expanded)
//this.Size = new Size(this.Size.Width+(expPrnSetting.Size.Width-expPrnSetting.TitlePanel.Size.Height), this.Size.Height);
//else
this.Size = new Size(this.Size.Width-(expPrnSetting.Size.Width-expPrnSetting.TitlePanel.Size.Height), this.Size.Height);
//Refresh();
Size = new Size(Size.Width-(expPrnSetting.Size.Width-expPrnSetting.TitlePanel.Size.Height), Size.Height);
}
@@ -1402,8 +1268,8 @@ namespace VEPROMS
if (_MergedPfd.MergedPdfs != null && _MergedPfd.MergedPdfs.Count > 0)
{
System.Diagnostics.Process sdp = System.Diagnostics.Process.Start(_MergedPfd.MergedFileName);
if (sdp != null) // B2020-055 if the current .NET version does not recognize the program used to display the PDF, it will return a NULL (ex. Microsoft Edge)
sdp.WaitForInputIdle();
// B2020-055 if the current .NET version does not recognize the program used to display the PDF, it will return a NULL (ex. Microsoft Edge)
sdp?.WaitForInputIdle();
}
}
else if (VlnSettings.DebugMode)
@@ -1416,7 +1282,7 @@ namespace VEPROMS
{
FlexibleMessageBox.Show("Completed Successfully", "Print All and Merge Procedures", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
this.Close();
Close();
}
private void cbxAssignRevToAllMergedPrcs_CheckedChanged(object sender, EventArgs e)
@@ -1428,10 +1294,5 @@ namespace VEPROMS
_NewRevForAllProcs = null;
}
//private void cbxDebug_CheckedChanged(object sender, EventArgs e)
//{
// cbxCmpPRMSpfd.Visible = cbxDebug.Checked;
//}
}
}