Exemple #1
0
 /// <summary>
 /// Fires all associated FileChanged delegates.
 /// </summary>
 public void OnChanged(object sender, FileSystemEventArgs e)
 {
     foreach (FileSystemEventHandler handler in FileChanged.GetInvocationList())
     {
         handler.Invoke(sender, e);
     }
 }
Exemple #2
0
        public void Dispose()
        {
            if (!IsDisposed)
            {
                IsDisposed = true;

                foreach (var item in FileDeleted.GetInvocationList())
                {
                    FileDeleted -= item as Action;
                }

                foreach (var item in FileChanged.GetInvocationList())
                {
                    FileChanged -= item as Action;
                }

                if (fileSystemWatcher != null)
                {
                    fileSystemWatcher.Dispose();
                    fileSystemWatcher = null;
                }
            }
        }