Exemplo n.º 1
0
 public MainWindowViewModel()
 {
     _domObject = new FileInformation();
     _informations = new ObservableCollection<FileInformation>();
     _toggleWatchingCmd = new RelayCommand(ToggleWatching, CanToggleWatching);
     _openSettingWindowCmd = new RelayCommand(OpenSettingWindow, CanOpenSettingWindow);
     _clearCollectionCmd = new RelayCommand(ClearCollection, CanClearCollection);
     _saveCollectionCmd = new RelayCommand(SaveCollection, CanSaveCollection);
     _toggleShowPreviewCmd = new RelayCommand(ToggleShowPreview, CanToggleShowPreview);
     _deleteFileCmd = new RelayCommand(DeleteFile, CanDeleteFile);
     _openFileCmd = new RelayCommand(OpenFile, CanOpenFile);
     _openContaingFolderCmd = new RelayCommand(OpenContaingFolder, CanOpenContaingFolder);
     _fileSystemWatcher = createWatcher();
     updateWatcherFromConfigFile();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Create FileSystemWatcher
 /// </summary>
 /// <returns></returns>
 private MyFileSystemWatcher createWatcher()
 {
     var watcher = new MyFileSystemWatcher();
     watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.Size;
     watcher.Created += new FileSystemEventHandler(this.fileSystemWatching);
     watcher.Deleted += new FileSystemEventHandler(this.fileSystemWatching);
     watcher.Changed += new FileSystemEventHandler(this.fileSystemWatching);
     watcher.Renamed += new RenamedEventHandler(this.fileSystemWatching);
     watcher.FilterRecentEvents = true;
     return watcher;
 }