private void MoveSelected() { var destBrowser = ElementHelper.DirectoryBrowser(); destBrowser.ShowDialog(); if (!String.IsNullOrEmpty(destBrowser.SelectedPath)) { var dest = new DirectoryInfo(destBrowser.SelectedPath); var directories = GetSelectedDirectories(); var files = GetSelectedFiles(); //Move selected directories foreach (var dir in directories.ToList()) { try { dir.MoveTo($"{dest.FullName}\\{dir.Name}"); } catch (Exception ex) { LogHelper.LogError(ex); } } //Move selected files foreach (var file in files.ToList()) { try { file.MoveTo($"{dest.FullName}\\{file.Name}"); } catch (Exception ex) { LogHelper.LogError(ex); } } contentsLabel.Content = $"Count: {newFilesListBox.Items.Count}"; selectedFilesListBox.Items.Clear(); } }
private void ShowConfig(Rule.ActionEnum ruleType) { CurrentConfigOptions?.ForEach(x => MainGrid.Children.Remove(x)); CurrentConfigOptions = new List <CheckBox>(); switch (ruleType) { case Rule.ActionEnum.Move: CurrentConfigOptions = MoveConfigOptions(); break; case Rule.ActionEnum.Copy: CurrentConfigOptions = CopyConfigOptions(); break; case Rule.ActionEnum.Delete: CurrentConfigOptions = DeleteConfigOptions(); break; case Rule.ActionEnum.DropboxCleanup: CurrentConfigOptions = DropboxConfigOptions(); break; case Rule.ActionEnum.CompressContents: CurrentConfigOptions = CompressConfigOptions(); break; case Rule.ActionEnum.PromptAction: CurrentConfigOptions = PromptActionOptions(); break; default: //If not called with a rule type but selection is not empty, try using text if (!String.IsNullOrEmpty(actionComboBox.Text)) { switch (actionComboBox.Text) { case "Move": CurrentConfigOptions = MoveConfigOptions(); break; case "Copy": CurrentConfigOptions = CopyConfigOptions(); break; case "Delete": CurrentConfigOptions = DeleteConfigOptions(); break; case "Dropbox Cleanup": CurrentConfigOptions = DropboxConfigOptions(); break; case "Compress Contents": CurrentConfigOptions = CompressConfigOptions(); break; case "Prompt Action": CurrentConfigOptions = PromptActionOptions(); break; default: break; } } break; } double nextY = -115; var left = configGroupBox.Margin.Left + CONFIG_PADDING_LEFT; foreach (var option in CurrentConfigOptions) { option.Margin = new Thickness(left, nextY, 0, 0); nextY = option.Margin.Top + option.Height + CONFIG_PADDING_TOP * 3; option.IsChecked = GetCheckBoxValue(option.Name); MainGrid.Children.Add(option); } var purgatoryCheckBox = CurrentConfigOptions.Find(x => x.Name == ElementHelper.DeletePurgatoryCheckBox); if (purgatoryCheckBox != null) { purgatoryCheckBox.ToolTip = ElementHelper.PurgatoryToolTip(); } }