//for watching updated file. private void AddFileWatcher(string configurationFolder, string watcherName, Action callBackMethod) { Application.Add(watcherName, new FileSystemWatcher(configurationFolder)); FileSystemWatcher watcher = (FileSystemWatcher)Application[watcherName]; watcher.EnableRaisingEvents = true; watcher.IncludeSubdirectories = true; watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite | NotifyFilters.CreationTime; watcher.Changed += delegate { (new Thread(new ThreadStart(delegate { watcher.ToString(); isWatcherUpdate = true; Thread.Sleep(5000); callBackMethod(); }))).Start(); }; }