我有以下子程序:
Private Sub Watcher_Changed(ByVal sender As System.Object, ByVal e As FileSystemEventArgs)
If Path.GetExtension(e.Name) = ".p2p" Then
Exit Sub
Else
Try
' multiple change events can be thrown. Check that file hasn't already been moved.
While Not File.Exists(e.FullPath)
Exit Try
End While
' throw further processing to a BackGroundWorker
ChangedFullPath = e.FullPath
ChangedFileName = e.Name
FileMover = New BackgroundWorker
AddHandler FileMover.DoWork, New DoWorkEventHandler(AddressOf ProcessFile)
FileMover.RunWorkerAsync()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
End Sub
当文件通过FTP上传时,我仍然会收到多个已更改文件的通知。
我想修改"Try"语句,如果在过去的(时间)内发生了更改通知,比如3秒钟内,也将其丢弃。这应该很简单,但由于某种原因今天它没有出现在我的脑海中,而且我也无法理解我在谷歌上找到的答案。
谢谢, 斯科特