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; }
// 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))); }