B2024-030 On the Working Draft properties page, added a check to see if we need to create the folder(s) for the path typed into the PDF Location text box. #320

Merged
plarsen merged 1 commits from B2024-030_SetOuptputPath into Development 2024-05-14 15:41:41 -04:00
2 changed files with 32 additions and 9 deletions
Showing only changes of commit 365f6a23c8 - Show all commits

View File

@ -254,7 +254,7 @@ namespace VEPROMS
//
this.ppBtnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ppBtnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.ppBtnCancel.Location = new System.Drawing.Point(742, 342);
this.ppBtnCancel.Location = new System.Drawing.Point(742, 338);
this.ppBtnCancel.Margin = new System.Windows.Forms.Padding(2);
this.ppBtnCancel.Name = "ppBtnCancel";
this.ppBtnCancel.Size = new System.Drawing.Size(56, 21);
@ -266,7 +266,7 @@ namespace VEPROMS
// ppBtnOK
//
this.ppBtnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ppBtnOK.Location = new System.Drawing.Point(669, 342);
this.ppBtnOK.Location = new System.Drawing.Point(669, 338);
this.ppBtnOK.Margin = new System.Windows.Forms.Padding(2);
this.ppBtnOK.Name = "ppBtnOK";
this.ppBtnOK.Size = new System.Drawing.Size(56, 21);

View File

@ -29,6 +29,7 @@ namespace VEPROMS
private List<MiniConfig> _DeletedApples;
private List<EnhancedMiniConfig> _Enhanced;
private DocVersionConfig _DocVersionConfig;
private string _OrgPDFPath; // B2024-030 used to save last PDF path
// Default values
private string _DefaultFormatName = null;
@ -97,6 +98,7 @@ namespace VEPROMS
_Initializing = true;
InitializeComponent();
_OrgPDFPath = _DocVersionConfig.Print_PDFLocation; // B2024-030 save last PDF path
btnGeneral.PerformClick(); // always start with General tab or button
_Initializing = false;
@ -323,8 +325,6 @@ namespace VEPROMS
tiApplicability.Visible = false;
}
ppTxtBxPDFLoc.TextChanged += new EventHandler(ppTxtBxPDFLoc_TextChanged);
//end add new applicability stuff
lblProcSetRev.Visible = ppRTxtProcSetRev.Visible = _DocVersionConfig.MyDocVersion.MyDocVersionInfo.ActiveFormat.MyStepSectionPrintData.UseXtraRevNumber;
@ -538,11 +538,32 @@ namespace VEPROMS
}
}
// The following code was added to fix Bug B2013-117
private void ppTxtBxPDFLoc_TextChanged(object sender, EventArgs e)
//B2024-030 Check the PDF Location path and prompt to create the folders if needed
private void CheckPDFLocationPath()
{
if (_Initializing == false)
_DocVersionConfig.Print_PDFLocation = ppTxtBxPDFLoc.Text;
string pdfloc = ppTxtBxPDFLoc.Text;
if (pdfloc == string.Empty) return;
if (!Directory.Exists(ppTxtBxPDFLoc.Text))
{
string msg = string.Format(" The Folder: '{0}' does not exist. \n\nCreate it?", ppTxtBxPDFLoc.Text);
DialogResult dr = MessageBox.Show(msg, "PDF Location Folder Not Found", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr == DialogResult.Yes)
{
try
{
Directory.CreateDirectory(ppTxtBxPDFLoc.Text);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error trying to create folder", MessageBoxButtons.OK, MessageBoxIcon.Error);
_DocVersionConfig.Print_PDFLocation = _OrgPDFPath; // reset to the path we started with
}
}
else
{
_DocVersionConfig.Print_PDFLocation = _OrgPDFPath; // reset to the path we started with
}
}
}
private string AddSlaveNode(MiniConfig mc)
@ -588,6 +609,9 @@ namespace VEPROMS
private void btnVersionsPropOK_Click(object sender, EventArgs e)
{
//B2024-030 Check the PDF Location path and prompt to create the folders if needed
CheckPDFLocationPath();
docVersionConfigBindingSource.EndEdit(); // need to end the edit session first or any format selection chanage will not stick B2015-157
// if there is a change to the format, clean up any overridden formats that point to the selected item before saving the format change:
@ -773,7 +797,6 @@ namespace VEPROMS
// B2019-132 update the association count for this working draft
_DocVersionConfig.MyDocVersion.MyDocVersionInfo.RefreshDocVersionAssociations();
this.Close();
}