diff --git a/ConfForm.Designer.cs b/ConfForm.Designer.cs index ccd382b..d837486 100644 --- a/ConfForm.Designer.cs +++ b/ConfForm.Designer.cs @@ -114,6 +114,7 @@ namespace PDF_Merge sourceDirBtn.TabIndex = 7; sourceDirBtn.Text = "..."; sourceDirBtn.UseVisualStyleBackColor = true; + sourceDirBtn.Click += sourceDirBtn_Click; // // outPathBtn // diff --git a/ConfForm.cs b/ConfForm.cs index 652f423..b4729f0 100644 --- a/ConfForm.cs +++ b/ConfForm.cs @@ -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; + } + } + } } }