Onchanged事件未更新网页UI。
程序控制流入OnChanged事件并更新UI组件的值,但不会反映在网页上。
public void FileWatcher()
{
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = xmldirectory;
watcher.NotifyFilter = NotifyFilters.LastWrite;
watcher.Filter = "*.xml";
watcher.Changed += new FileSystemEventHandler(OnChanged);
watcher.EnableRaisingEvents = true;
}
private void OnChanged(object source, FileSystemEventArgs e)
{
txtStatus.Text ="Changed";
btnCheck.Enabled = false;
}