PDF-Merge/MainForm.cs
efrick 1d332927d6 Update code to reflect change in config file.
The configuration now seperates the output path and filename into
seperate componentants.
2024-08-05 14:32:13 -04:00

79 lines
2.1 KiB
C#

using System.Configuration;
namespace PDF_Merge
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
SetPathLable();
}
public void SetPathLable()
{
string sourcePath = ConfigurationManager.AppSettings["PDF-Path"];
if (sourcePath != null)
{
if (sourcePath != "")
{
if (Directory.Exists(sourcePath))
{
pathLable.Text = "Path: " + sourcePath;
}
else
{
pathLable.Text = "The configured path does not exist.";
}
}
else
{
pathLable.Text = "The configured path is blank.";
}
}
else
{
pathLable.Text = "No path has been configured.";
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void label1_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
string[] pdf_files = MergePDFs.CollectPdfFiles();
string pdfPath = ConfigurationManager.AppSettings["PDF-Output"] + "/" + ConfigurationManager.AppSettings["PDF-Name"];
MergePDFs.MergePdfFiles(pdf_files, pdfPath);
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Environment.Exit(0);
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
AboutBox1 AboutWindow = new AboutBox1();
AboutWindow.Show();
}
private void configureToolStripMenuItem_Click(object sender, EventArgs e)
{
ConfForm ConfForm = new ConfForm();
ConfForm.Show();
}
private void MainForm_Activated(object sender, EventArgs e)
{
SetPathLable();
}
}
}