當前位置: 首頁>>代碼示例>>C#>>正文


C# FileSystemWatcher.DispatchEvents方法代碼示例

本文整理匯總了C#中System.IO.FileSystemWatcher.DispatchEvents方法的典型用法代碼示例。如果您正苦於以下問題:C# FileSystemWatcher.DispatchEvents方法的具體用法?C# FileSystemWatcher.DispatchEvents怎麽用?C# FileSystemWatcher.DispatchEvents使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.IO.FileSystemWatcher的用法示例。


在下文中一共展示了FileSystemWatcher.DispatchEvents方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PostEvent

		private void PostEvent (string filename, FileSystemWatcher fsw, FileAction fa, FileSystemInfo changedFsi) {
			RenamedEventArgs renamed = null;
			if (fa == 0)
				return;
			
			if (fsw.IncludeSubdirectories && fa == FileAction.Added) {
				if (changedFsi is DirectoryInfo) {
					KeventData newdirdata = new KeventData ();
					newdirdata.FSW = fsw;
					newdirdata.Directory = changedFsi.FullName;
					newdirdata.FileMask = fsw.MangledFilter;
					newdirdata.IncludeSubdirs = fsw.IncludeSubdirectories;
	
					newdirdata.Enabled = true;
					lock (this) {
						StartMonitoringDirectory (newdirdata);
					}
				}
			}
		
			if (!fsw.Pattern.IsMatch(filename, true))
				return;

			lock (fsw) {
				if (changedFsi.FullName.StartsWith (fsw.FullPath, StringComparison.Ordinal))
					filename = changedFsi.FullName.Substring (fsw.FullPath.Length + 1);
				fsw.DispatchEvents (fa, filename, ref renamed);
				if (fsw.Waiting) {
					fsw.Waiting = false;
					System.Threading.Monitor.PulseAll (fsw);
				}
			}
		}
開發者ID:av8,項目名稱:mono,代碼行數:33,代碼來源:KeventWatcher.cs

示例2: DispatchEvents

		static void DispatchEvents (FileSystemWatcher fsw, FileAction action, string filename)
		{
			RenamedEventArgs renamed = null;

			lock (fsw) {
				fsw.DispatchEvents (action, filename, ref renamed);
				if (fsw.Waiting) {
					fsw.Waiting = false;
					System.Threading.Monitor.PulseAll (fsw);
				}
			}
		}
開發者ID:JokerMisfits,項目名稱:linux-packaging-mono,代碼行數:12,代碼來源:DefaultWatcher.cs


注:本文中的System.IO.FileSystemWatcher.DispatchEvents方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。