public void SetSource() { var folder = FindObjects.FindFolders(currentPath); var files = FindObjects.FindFiles(currentPath); Elements = folder; for (int i = 0; i < files.Count; i++) { Elements.Add(files[i]); } try { ElementList.ItemsSource = Elements; } catch { } for (int i = 0; i < Elements.Count; i++) { for (int j = 0; j < CheckedElements.Count; j++) { if (CheckedElements[j].path == Elements[i].path) { Elements[i].isSelected = CheckedElements[j].isSelected; break; } } } ShowingPath = currentPath; CurrDir.Text = ShowingPath; CheckList.ItemsSource = CheckedElements; }
internal void Folders(string path) { foreach (var p in FindObjects.FindFolders(path)) { var files = FindObjects.FindFiles(p.path); foreach (var t in files) { CheckedElements.Add(t); } Folders(p.path); } }
private void CheckBox_Checked(object sender, RoutedEventArgs e) { if (((Element)((CheckBox)sender).DataContext).type == "file") { CheckedElements.Add((Element)((CheckBox)sender).DataContext); } else { var files = FindObjects.FindFiles(((Element)((CheckBox)sender).DataContext).path); foreach (var t in files) { CheckedElements.Add(t); CheckedElements[CheckedElements.Count - 1].isSelected = true; } Folders((((Element)((CheckBox)sender).DataContext).path)); } }