Initial commit. Added a helper class for easy access to the app.config settings.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Configuration;
|
||||
|
||||
namespace DataOrganizer
|
||||
{
|
||||
static class GlobalSettings
|
||||
{
|
||||
public static bool TryGetStringSetting(string keyName, out string value)
|
||||
{
|
||||
value = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
value = ConfigurationManager.AppSettings[keyName];
|
||||
|
||||
if (string.IsNullOrEmpty(value)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
//toolStripStatusLabel1.Text = "Failed to get app key: " + keyName + ".";
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user