Update the PathLable in the main form when configuration changes.

This commit is contained in:
2024-08-05 13:55:36 -04:00
parent 6d06fa90e5
commit b1368e3c53
2 changed files with 17 additions and 4 deletions
+16 -4
View File
@@ -7,6 +7,11 @@ namespace PDF_Merge
public MainForm()
{
InitializeComponent();
SetPathLable();
}
public void SetPathLable()
{
string sourcePath = ConfigurationManager.AppSettings["PDF-Path"];
if (sourcePath != null)
{
@@ -14,16 +19,19 @@ namespace PDF_Merge
{
if (Directory.Exists(sourcePath))
{
pathLable.Text = pathLable.Text + sourcePath;
} else
pathLable.Text = "Path: " + sourcePath;
}
else
{
pathLable.Text = "The configured path does not exist.";
}
} else
}
else
{
pathLable.Text = "The configured path is blank.";
}
} else
}
else
{
pathLable.Text = "No path has been configured.";
}
@@ -61,5 +69,9 @@ namespace PDF_Merge
ConfForm ConfForm = new ConfForm();
ConfForm.Show();
}
private void MainForm_Activated(object sender, EventArgs e)
{
SetPathLable();
}
}
}