FileSystemWatcher OnChanged事件未更新网页UI

时间:2014-11-19 12:30:48

标签: c# asp.net

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;
        }

0 个答案:

没有答案