private void excludeFolderAdd_Click(object sender, RoutedEventArgs e) { using (var folderBrowser = new FolderBrowserDialog()) { folderBrowser.Description = "Select a folder to exclude from check for duplicate files"; if (folderBrowser.ShowDialog(WindowWrapper.GetCurrentWindowHandle()) != DialogResult.OK) { return; } var excFolder = new ExcludeFolder(folderBrowser.SelectedPath); if (_scanBase.Options.ExcludeFolders.Contains(excFolder)) { MessageBox.Show(Application.Current.MainWindow, "The selected folder is already excluded", Utils.ProductName, MessageBoxButton.OK, MessageBoxImage.Error); } else if (_scanBase.Options.OnlySelectedFolders.GetValueOrDefault() && _scanBase.Options.IncFolders.Contains(new IncludeFolder(folderBrowser.SelectedPath))) { MessageBox.Show(Application.Current.MainWindow, "The selected folder cannot be in both the included and excluded folders", Utils.ProductName, MessageBoxButton.OK, MessageBoxImage.Error); } else { _scanBase.Options.ExcludeFolders.Add(excFolder); MessageBox.Show(Application.Current.MainWindow, "The selected folder has been excluded from the search", Utils.ProductName, MessageBoxButton.OK, MessageBoxImage.Information); } } }
private void buttonSelectMoveFolder_Click(object sender, RoutedEventArgs e) { using (var folderBrowserDlg = new FolderBrowserDialog()) { if (!string.IsNullOrEmpty(MoveFolder)) { folderBrowserDlg.SelectedPath = MoveFolder; } if (folderBrowserDlg.ShowDialog(WindowWrapper.GetCurrentWindowHandle()) != DialogResult.OK) { return; } MoveFolder = folderBrowserDlg.SelectedPath; MessageBox.Show(Application.Current.MainWindow, "Folder to move junk files to has been updated", Utils.ProductName, MessageBoxButton.OK, MessageBoxImage.Information); } }
private void buttonBrowse_Click(object sender, RoutedEventArgs e) { if (FileVisible == Visibility.Visible) { using (var fileDlg = new OpenFileDialog()) { fileDlg.Title = "Select file path to ignore"; if (File.Exists(FilePath)) { fileDlg.InitialDirectory = Path.GetDirectoryName(FilePath); fileDlg.FileName = Path.GetFileName(FilePath); } if (fileDlg.ShowDialog(WindowWrapper.GetCurrentWindowHandle()) == System.Windows.Forms.DialogResult.OK) { FilePath = fileDlg.FileName; } } } else if (FolderVisible == Visibility.Visible) { using (var folderDlg = new FolderBrowserDialog()) { folderDlg.Description = "Select folder path to ignore"; if (Directory.Exists(FolderPath)) { folderDlg.SelectedPath = FolderPath; } if (folderDlg.ShowDialog(WindowWrapper.GetCurrentWindowHandle()) == System.Windows.Forms.DialogResult.OK) { FolderPath = folderDlg.SelectedPath; } } } }