示例#1
0
        private void CompletePathInTextbox(IQuickWindow quickWindow, KeyEventArgs e)
        {
            var    modifiers = e.KeyboardDevice.Modifiers;
            string queryPath = quickWindow.GetArgument();

            if (queryPath.Length == 0)
            {
                return;
            }

            if (TextDirty)
            {
                ResultList = GetCurrentPathFileNames(queryPath);
            }

            if (ResultList.Count == 0)
            {
                return;
            }

            if (modifiers != ModifierKeys.Shift)
            {
                AutoSearchIndex = ++AutoSearchIndex % ResultList.Count;
            }
            else if (modifiers == ModifierKeys.Shift)
            {
                AutoSearchIndex = --AutoSearchIndex < 0 ? ResultList.Count - 1 : AutoSearchIndex;
            }

            string content  = quickWindow.GetQueryText();
            string replaced = content.Replace(queryPath, ResultList[AutoSearchIndex]);

            quickWindow.SetQueryText(replaced);
            var textbox = quickWindow.GetQueryTextBox();

            textbox.CaretPosition = textbox.Document.ContentEnd;
        }