private void btnCopy_Click(object sender, RoutedEventArgs e) { _currentImage = null; List <string> dirsToCopyTo = new List <string>(); foreach (object c in unfiformGridSubfolders.Children) { PathCheckBox chk = (PathCheckBox)c; if ((bool)chk.IsChecked) { dirsToCopyTo.Add(chk.FullPath); } } foreach (string dir in dirsToCopyTo) { File.Copy(_pathList[_currentImageIndex], dir + @"\" + System.IO.Path.GetFileName(_pathList[_currentImageIndex]), true); } _currentImage = null; File.Delete(_pathList[_currentImageIndex]); foreach (object c in unfiformGridSubfolders.Children) { (c as PathCheckBox).IsChecked = false; } _currentImageIndex++; UpdatePictureBox(); }
private void btnSelectSubfolderFolder_Click(object sender, RoutedEventArgs e) { FolderBrowserDialog dlg = new FolderBrowserDialog(); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { unfiformGridSubfolders.Children.Clear(); lblSubfolderFolderPath.Content = dlg.SelectedPath; SearchOption so; if ((bool)checkBoxSubSubDirectories.IsChecked) { so = SearchOption.AllDirectories; } else { so = SearchOption.TopDirectoryOnly; } string[] subfolders = Directory.GetDirectories(dlg.SelectedPath, "*", so); List <PathCheckBox> _checkBoxes = new List <PathCheckBox>(); foreach (string folder in subfolders) { PathCheckBox chk = new PathCheckBox(); chk.Content = new DirectoryInfo(folder).Name; chk.FullPath = folder; chk.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; chk.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; chk.Margin = new Thickness(10, 0, 0, 0); unfiformGridSubfolders.Children.Add(chk); } } }
private void btnSelectSubfolderFolder_Click(object sender, RoutedEventArgs e) { FolderBrowserDialog dlg = new FolderBrowserDialog(); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { unfiformGridSubfolders.Children.Clear(); lblSubfolderFolderPath.Content = dlg.SelectedPath; SearchOption so; if ((bool)checkBoxSubSubDirectories.IsChecked) so = SearchOption.AllDirectories; else so = SearchOption.TopDirectoryOnly; string[] subfolders = Directory.GetDirectories(dlg.SelectedPath, "*", so); List<PathCheckBox> _checkBoxes = new List<PathCheckBox>(); foreach (string folder in subfolders) { PathCheckBox chk = new PathCheckBox(); chk.Content = new DirectoryInfo(folder).Name; chk.FullPath = folder; chk.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; chk.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; chk.Margin = new Thickness(10, 0, 0, 0); unfiformGridSubfolders.Children.Add(chk); } } }