diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 05d2e02..e7ce962 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -119,6 +119,7 @@ MainMenuStrip = menuStrip1; Name = "MainForm"; Text = "PDF-Merge"; + Activated += MainForm_Activated; Load += Form1_Load; menuStrip1.ResumeLayout(false); menuStrip1.PerformLayout(); diff --git a/MainForm.cs b/MainForm.cs index 7cd0520..f9d615d 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -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(); + } } }