public InputBoxForm(InputBoxHistory currentKey) { InitializeComponent(); _mru = new PersistMostRecentlyUsedList(currentKey); this.StartPosition = FormStartPosition.CenterParent; this.Text = " "; this.AllowDrop = true; this._comboBox.Focus(); // we don't use autocomplete, we just enable it // to get the Ctrl+Backspace shortcut this._comboBox.AutoCompleteMode = AutoCompleteMode.Append; }
public FormSortFiles(SortFilesAction action) { InitializeComponent(); _action = action; _mruHistoryLeft = new PersistMostRecentlyUsedList(InputBoxHistory.SyncDirectoryLeft); _mruHistoryRight = new PersistMostRecentlyUsedList(InputBoxHistory.SyncDirectoryRight); cmbLeftDir.DragDrop += new DragEventHandler(CmbOnDragDrop); cmbLeftDir.DragEnter += new DragEventHandler(CmbOnDragEnter); cmbRightDir.DragDrop += new DragEventHandler(CmbOnDragDrop); cmbRightDir.DragEnter += new DragEventHandler(CmbOnDragEnter); RefreshComboListItems(); AcceptButton = btnStart; cmbLeftDir.Text = cmbLeftDir.Items.Count > 0 ? cmbLeftDir.Items[0].ToString() : ""; cmbRightDir.Text = cmbRightDir.Items.Count > 0 ? cmbRightDir.Items[0].ToString() : ""; if (action != SortFilesAction.SyncFiles) { btnStart.Text = "Start..."; btnShowRobo.Visible = false; txtShowRobo.Visible = false; checkMirror.Visible = false; checkPreview.Visible = false; lblSkipDirs.Visible = false; lblSkipFiles.Visible = false; txtSkipDirs.Visible = false; txtSkipFiles.Visible = false; lblLeftDirDesc.Text = "Directory #1:"; lblRightDirDesc.Text = "Directory #2:"; checkAllowDifferSeconds.Text = checkAllowDifferSeconds.Text.Replace("$", SortFilesSearchDifferences.AllowDifferSeconds.ToString()); } else { checkMirror.Checked = true; checkAllowDifferSeconds.Text = checkAllowDifferSeconds.Text.Replace("$", SyncFilesWithRobocopy.AllowDifferSeconds.ToString()); } if (action == SortFilesAction.SearchDifferences) { lblAction.Text = @"Search for differences in two similar folders."; } else if (action == SortFilesAction.SearchDuplicates) { lblAction.Text = "Search for duplicate files."; checkAllowDifferDST.Visible = false; checkAllowDifferSeconds.Text = "Files with same name, size, " + "and last-modified time treated as equal (faster)"; } else if (action == SortFilesAction.SearchDuplicatesInOneDir) { lblAction.Text = "Search for duplicate files in a folder."; lblLeftDirDesc.Text = "Directory:"; lblRightDirDesc.Text = ""; btnSetRightDir.Visible = false; cmbRightDir.Visible = false; btnSwap.Visible = false; checkAllowDifferDST.Visible = false; checkAllowDifferSeconds.Visible = false; } else if (action == SortFilesAction.SyncFiles) { lblAction.Text = "Sync files. " + "Copy changes from the source directory to the destination directory."; } }
// add MRU history, suggestions, and clipboard contents to the list of examples. public static IEnumerable <string> GetInputSuggestions(string currentSuggestion, InputBoxHistory historyKey, PersistMostRecentlyUsedList history, bool useClipboard, bool mustBeDirectory, string[] more) { List <string> suggestions = new List <string>(); if (!string.IsNullOrEmpty(currentSuggestion)) { suggestions.Add(currentSuggestion); } if (useClipboard && !string.IsNullOrEmpty(Utils.GetClipboard()) && Utils.LooksLikePath(Utils.GetClipboard()) == mustBeDirectory) { // get from clipboard if the right type of string (path vs not path) suggestions.Add(Utils.GetClipboard()); } if (historyKey != InputBoxHistory.None) { suggestions.AddRange(history.Get()); } if (more != null) { suggestions.AddRange(more); } return(suggestions.Where(entry => !mustBeDirectory || FilenameUtils.IsPathRooted(entry))); }