Binboo.Core.Configuration.CoreConfig.EnsureConfigIsLoaded C# (CSharp) Method

EnsureConfigIsLoaded() private static method

private static EnsureConfigIsLoaded ( ) : void
return void
        private static void EnsureConfigIsLoaded()
        {
            if (_config == null)
            {
                _config = new XmlDocument();
                _config.Load(ConfigFilePath());

                var watcher = new FileSystemWatcher(Path.GetDirectoryName(ConfigFilePath()), Path.GetFileName(ConfigFilePath()));
                FileSystemEventHandler configChangedHandler = delegate
                {
                    watcher = null;
                    _config = null;
                };

                watcher.Changed += configChangedHandler;
                watcher.NotifyFilter = NotifyFilters.LastWrite;
                watcher.EnableRaisingEvents = true;
            }
        }