private void button1_Click(object sender, EventArgs e) { ListenToFolder(@"F:\EscherData\"); } private void ListenToFolder(string path) { try { FileSystemWatcher fs = new FileSystemWatcher(path); fs.IncludeSubdirectories = false; fs.Created += new FileSystemEventHandler(OnFileCreate); fs.EnableRaisingEvents = true; } catch (Exception e) { //MessageBox.Show(e.ToString()); } } private void OnFileCreate(object e, FileSystemEventArgs ev) { try { ReadXmlData(ev.FullPath); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)