public SharedFolderWatcher(string target, eAssignedLane_Printer laneID, string path = "") { Target = target; LaneID = laneID; //WatchedFiles = new MutexFileQueue<string>(target); WatchedFiles.Clear(); Watcher = new DirectoryWatcher(target); Watcher.AddOnCreatedEventHandler(OnCreateFileInWatchedFolder); Watcher.AddOnRenamedEventHandler(OnRenameFileInWatchedFolder); if (laneID == eAssignedLane_Printer.Lane1) { ViewModelLocator.Atom.FlowHostVM.IsLane1WFExist = true; ViewModelLocator.Atom.FlowHostVM.Lane1WFDisk = target; ViewModelLocator.Atom.FlowHostVM.Lane1WFPath = path; } else if (laneID == eAssignedLane_Printer.Lane2) { ViewModelLocator.Atom.FlowHostVM.IsLane2WFExist = true; ViewModelLocator.Atom.FlowHostVM.Lane1WFDisk = target; ViewModelLocator.Atom.FlowHostVM.Lane2WFPath = path; } Watcher.BeginWatching(); }