Example #1
0
        private void OnRenamed(object source, RenamedEventArgs e)
        {
            // Specify what is done when a file is renamed.
            System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => {
                if (Path.GetExtension(e.OldFullPath) == myExtension || Path.GetExtension(e.FullPath) == myExtension)
                {
                    return;
                }

                Debug.WriteLine("Added two tasks, file: {0} renamed to {1}", e.OldName, e.Name);
                writeToLog(String.Format("Added two tasks, file: {0} renamed to {1}", e.OldName, e.Name));
                var toDelete      = new FileTask(e.OldName);
                toDelete.fileMode = 'D';
                addFileTask(toDelete);
                addFileTask(new FileTask(e.Name));
                accessCriticalSection();
            }));
        }
Example #2
0
 // Define the event handlers.
 private void OnChanged(object source, FileSystemEventArgs e)
 {
     // Specify what is done when a file is changed, created, or deleted.
     System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => {
         if (Path.GetExtension(e.FullPath) == myExtension)
         {
             return;
         }
         Debug.WriteLine("Added task file: " + e.Name + " " + e.ChangeType);
         writeToLog("Added task file: " + e.Name + " " + e.ChangeType);
         var filetask = new FileTask(e.Name);
         if (e.ChangeType == WatcherChangeTypes.Deleted)
         {
             filetask.fileMode = 'D';
         }
         addFileTask(filetask);
         accessCriticalSection();
     }));
 }
        private void OnRenamed(object source, RenamedEventArgs e)
        {
            // Specify what is done when a file is renamed.
            System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => {
                if (Path.GetExtension(e.OldFullPath) == myExtension || Path.GetExtension(e.FullPath) == myExtension)
                    return;

                Debug.WriteLine("Added two tasks, file: {0} renamed to {1}", e.OldName, e.Name);
                writeToLog(String.Format("Added two tasks, file: {0} renamed to {1}", e.OldName, e.Name));
                var toDelete = new FileTask(e.OldName);
                toDelete.fileMode = 'D';
                addFileTask(toDelete);
                addFileTask(new FileTask(e.Name));
                accessCriticalSection();
            }));
        }
 // Define the event handlers.
 private void OnChanged(object source, FileSystemEventArgs e)
 {
     // Specify what is done when a file is changed, created, or deleted.
     System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => {
         if (Path.GetExtension(e.FullPath) == myExtension)
             return;
         Debug.WriteLine("Added task file: " + e.Name + " " + e.ChangeType);
         writeToLog("Added task file: " + e.Name + " " + e.ChangeType);
         var filetask = new FileTask(e.Name);
         if (e.ChangeType == WatcherChangeTypes.Deleted)
             filetask.fileMode = 'D';
         addFileTask(filetask);
         accessCriticalSection();
     }));
 }
 private void addFileTask(FileTask task)
 {
     toSendCritical.RemoveAll(c => c.fileName == task.fileName);
     toSendCritical.Add(task);
 }
Example #6
0
 private void addFileTask(FileTask task)
 {
     toSendCritical.RemoveAll(c => c.fileName == task.fileName);
     toSendCritical.Add(task);
 }