Example #1
0
        // 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)));
        }
Example #2
0
        void RefreshComboListItems()
        {
            cmbLeftDir.Items.Clear();
            cmbRightDir.Items.Clear();

            foreach (var s in _mruHistoryLeft.Get())
            {
                cmbLeftDir.Items.Add(s);
            }

            foreach (var s in _mruHistoryRight.Get())
            {
                cmbRightDir.Items.Add(s);
            }
        }