Add FolderPicker to source selection in config menu.

This commit is contained in:
efrick 2024-08-05 14:06:17 -04:00
parent b1368e3c53
commit f85361ed27
2 changed files with 17 additions and 2 deletions

1
ConfForm.Designer.cs generated
View File

@ -114,6 +114,7 @@ namespace PDF_Merge
sourceDirBtn.TabIndex = 7;
sourceDirBtn.Text = "...";
sourceDirBtn.UseVisualStyleBackColor = true;
sourceDirBtn.Click += sourceDirBtn_Click;
//
// outPathBtn
//

View File

@ -44,14 +44,16 @@ namespace PDF_Merge
if (sourceBox.Text.Length > 0)
{
appSettings.Settings["PDF-Path"].Value = sourceBox.Text;
} else
}
else
{
MessageBox.Show("Source path cannot be empty.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
if (outputBox.Text.Length > 0)
{
appSettings.Settings["PDF-Output"].Value = outputBox.Text;
} else
}
else
{
MessageBox.Show("Output path cannot be empty.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
@ -60,5 +62,17 @@ namespace PDF_Merge
ConfigurationManager.RefreshSection("appSettings");
this.Close();
}
private void sourceDirBtn_Click(object sender, EventArgs e)
{
using (var SourceDirPicker = new FolderBrowserDialog())
{
if(SourceDirPicker.ShowDialog() == DialogResult.OK)
{
var sourceDir = SourceDirPicker.SelectedPath;
sourceBox.Text = sourceDir;
}
}
}
}
}