private void sortFileList(object sender, RoutedEventArgs e) { string parentPath = PanelPath(); MyDirectory myDirectory = new MyDirectory(parentPath); listOfDiscElements.Children.Clear(); List <DiscElement> allFiles = myDirectory.GetSubDiscElements(); for (int i = 1; i < allFiles.Count; ++i) { allFiles.Sort(); } foreach (DiscElement file in allFiles) { string prePath = file.Path; string postPath = prePath.Replace(parentPath + @"\", ""); DiscElementView discElementView = new DiscElementView(file); listOfDiscElements.Children.Add(discElementView); discElementView.openDiscElementClick += createFileListEventHandler; discElementView.checkedDiscElementEvent += checkedDiscElementEventHandler; } FileSystemWatcher filesystemwatcher = new FileSystemWatcher(parentPath); filesystemwatcher.Created += FileSystemWatcher_Created; filesystemwatcher.Deleted += FileSystemWatcher_Created; filesystemwatcher.Renamed += FileSystemWatcher_Created; filesystemwatcher.EnableRaisingEvents = true; }
private void searchForFile() { string parentPath = PanelPath(); string destFile = searchForFiles.Text; MyDirectory myDirectory = new MyDirectory(parentPath); listOfDiscElements.Children.Clear(); List <DiscElement> allFiles = myDirectory.GetSubDiscElements(); var filteredFiles = allFiles.Where(f => f.Name.Contains(destFile)); foreach (DiscElement file in filteredFiles) { string prePath = file.Path; DiscElementView discElementView = new DiscElementView(file); listOfDiscElements.Children.Add(discElementView); discElementView.openDiscElementClick += createFileListEventHandler; discElementView.checkedDiscElementEvent += checkedDiscElementEventHandler; discElementView.imgPopupMouseEnterEvent += imgPopupMouseEnterEventHandler; discElementView.imgPopupMouseLeaveEvent += imgPopupMouseLeaveEventHandler; discElementView.imgPopupMouseOverEvent += imgPopupMouseOverEventHandler; } FileSystemWatcher filesystemwatcher = new FileSystemWatcher(parentPath); filesystemwatcher.Created += FileSystemWatcher_Created; filesystemwatcher.Deleted += FileSystemWatcher_Created; filesystemwatcher.Renamed += FileSystemWatcher_Created; filesystemwatcher.EnableRaisingEvents = true; }
private void createFileList(string path) { string parentPath = path; MyDirectory myDirectory = new MyDirectory(parentPath); listOfDiscElements.Children.Clear(); List <DiscElement> allFiles = myDirectory.GetSubDiscElements(); foreach (DiscElement file in allFiles) { string prePath = file.Path; string postPath = prePath.Replace(parentPath + @"\", ""); DiscElementView discElementView = new DiscElementView(file); listOfDiscElements.Children.Add(discElementView); discElementView.openDiscElementClick += createFileListEventHandler; discElementView.checkedDiscElementEvent += checkedDiscElementEventHandler; } FileSystemWatcher filesystemwatcher = new FileSystemWatcher(parentPath); filesystemwatcher.Created += FileSystemWatcher_Created; filesystemwatcher.Deleted += FileSystemWatcher_Created; filesystemwatcher.Renamed += FileSystemWatcher_Created; filesystemwatcher.EnableRaisingEvents = true; }