diff --git a/ConfForm.Designer.cs b/ConfForm.Designer.cs index f529f95..77869db 100644 --- a/ConfForm.Designer.cs +++ b/ConfForm.Designer.cs @@ -37,7 +37,7 @@ namespace PDF_Merge folderBrowserDialog1 = new FolderBrowserDialog(); sourceLabel = new Label(); outputLabel = new Label(); - checkBox1 = new CheckBox(); + overrideCBox = new CheckBox(); sourceDirBtn = new Button(); outPathBtn = new Button(); SuspendLayout(); @@ -59,7 +59,7 @@ namespace PDF_Merge cancelBtn.TabIndex = 1; cancelBtn.Text = "Cancel"; cancelBtn.UseVisualStyleBackColor = true; - cancelBtn.Click += this.cancelBtn_Click; + cancelBtn.Click += cancelBtn_Click; // // sourceBox // @@ -93,17 +93,17 @@ namespace PDF_Merge outputLabel.TabIndex = 5; outputLabel.Text = "Output Path"; // - // checkBox1 + // overrideCBox // - checkBox1.AutoSize = true; - checkBox1.Checked = true; - checkBox1.CheckState = CheckState.Checked; - checkBox1.Location = new Point(171, 105); - checkBox1.Name = "checkBox1"; - checkBox1.Size = new Size(179, 29); - checkBox1.TabIndex = 6; - checkBox1.Text = "Overwrite Existing"; - checkBox1.UseVisualStyleBackColor = true; + overrideCBox.AutoSize = true; + overrideCBox.Checked = true; + overrideCBox.CheckState = CheckState.Checked; + overrideCBox.Location = new Point(171, 105); + overrideCBox.Name = "overrideCBox"; + overrideCBox.Size = new Size(179, 29); + overrideCBox.TabIndex = 6; + overrideCBox.Text = "Overwrite Existing"; + overrideCBox.UseVisualStyleBackColor = true; // // sourceDirBtn // @@ -130,7 +130,7 @@ namespace PDF_Merge ClientSize = new Size(500, 282); Controls.Add(outPathBtn); Controls.Add(sourceDirBtn); - Controls.Add(checkBox1); + Controls.Add(overrideCBox); Controls.Add(outputLabel); Controls.Add(sourceLabel); Controls.Add(outputBox); @@ -152,7 +152,7 @@ namespace PDF_Merge private FolderBrowserDialog folderBrowserDialog1; private Label sourceLabel; private Label outputLabel; - private CheckBox checkBox1; + private CheckBox overrideCBox; private Button sourceDirBtn; private Button outPathBtn; } diff --git a/ConfForm.cs b/ConfForm.cs index cd18ea3..c558cef 100644 --- a/ConfForm.cs +++ b/ConfForm.cs @@ -18,10 +18,18 @@ namespace PDF_Merge InitializeComponent(); string sourcePath = ConfigurationManager.AppSettings["PDF-Path"]; - string outputPath = ConfigurationManager.AppSettings["PDF-output"]; + string outputPath = ConfigurationManager.AppSettings["PDF-Output"]; sourceBox.Text = sourcePath; outputBox.Text = outputPath; + if (ConfigurationManager.AppSettings["overwrite"] == "true") + { + overrideCBox.Checked = true; + } + else + { + overrideCBox.Checked = false; + } } private void cancelBtn_Click(object sender, EventArgs e) diff --git a/Program.cs b/Program.cs index 36d6500..dc3f031 100644 --- a/Program.cs +++ b/Program.cs @@ -1,3 +1,5 @@ +using System.Configuration; + namespace PDF_Merge { internal static class Program @@ -13,6 +15,10 @@ namespace PDF_Merge // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); Application.Run(new MainForm()); + if (ConfigurationManager.AppSettings["PDF-Path"] == "" || ConfigurationManager.AppSettings["PDF-Path"] == null || ConfigurationManager.AppSettings["PDF-Output"] == "" || ConfigurationManager.AppSettings["PDF-Output"] == null) + { + Application.Run(new ConfForm()); + } } } } \ No newline at end of file