コード例 #1
0
        public static void SuggestionKeyHandler(KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Enter:
                string textToInsert   = SuggestionProvider.GetItem();
                int    lastWordLength = Utility.GetLastWord().Length;
                string textToAppend   = textToInsert.Substring(lastWordLength);
                int    select         = editor.SelectionStart;
                Utility.AppendText(editor, Coloring.GetColor(textToInsert), textToAppend);
                editor.SelectionStart = select + textToAppend.Length;
                Coloring.DoColoring();
                Utility.AppendText(editor, Color.Black, " ");
                editor.SelectionStart = editor.SelectionStart + 1;
                Utility.ClearSuggestionList();
                Utility.FocusEditor();
                break;

            case Keys.Escape:
                Utility.ClearSuggestionList();
                Utility.FocusEditor();
                break;

            default:
                break;
            }
        }
コード例 #2
0
        private void NrichTextBox_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                this.ListBoxPosition();
                switch (e.KeyChar)
                {
                case ((char)Keys.Back):
                    temp = temp.Remove(temp.Length - 1);
                    break;

                case ((char)Keys.Space):
                    temp = null;
                    suggestionBox.Items.Clear();
                    //this.ListBoxPosition();
                    break;

                default:
                    temp += e.KeyChar.ToString();
                    SuggestionProvider.GetSuggestion(temp);
                    //this.ListBoxPosition();
                    break;
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #3
0
        private async void OnSearchSuggestionRequested(SearchPane sender, SearchPaneSuggestionsRequestedEventArgs args)
        {
            var deferral    = args.Request.GetDeferral();
            var suggestions = await SuggestionProvider.GetSuggestionsAsync(args.QueryText);

            args.Request.SearchSuggestionCollection.AppendQuerySuggestions(suggestions);
            deferral.Complete();
        }
コード例 #4
0
        static void Main(string[] args)
        {
            var cityRepository = new FileCityRepository(@"C:\Users\matzoliv\dev\backend-coding-challenge\cities_canada-usa-big.tsv");

            var suggestionProvider = new SuggestionProvider(cityRepository, new CoveoBCC.Core.Searcher.NameSearcherFactory());

            var xs = suggestionProvider.GetSuggestions("west c", 20).ToList();
        }
コード例 #5
0
 public static void Init(RichTextBox editor, RichTextBox errorLog, ListBox suggestionBox)
 {
     Utility.Init(editor, errorLog, suggestionBox);
     KeyEventsHandler.Init(editor, errorLog, suggestionBox);
     TokenGenerator.InitBox(editor);
     Highlighter.Init(editor);
     SuggestionProvider.InitSuggestionProvider(new List <string>(), suggestionBox, editor);
     Coloring.InitColoring(editor);
     Helper.Init();
     MenuItemEvents.Init(editor);
 }
コード例 #6
0
ファイル: Form1.cs プロジェクト: ShamsBinSohrab/Reshaper
        private void NrichTextBox_KeyUp(object sender, KeyEventArgs e)
        {
            suggestionBox.Items.Clear();
            SuggestionProvider.GetSuggestion(Utility.GetLastWord());
            KeyEventsHandler.EditorKeyHandler(e);

            if (e.KeyCode == Keys.Enter)
            {
                if (BackgroundErrorTracer.IsBusy)
                {
                    BackgroundErrorTracer.CancelAsync();
                }
                else
                {
                    BackgroundErrorTracer.RunWorkerAsync();
                }
            }
        }
コード例 #7
0
 public RequiredArgumentBuilder <TSource, T> Suggests(SuggestionProvider <TSource> provider)
 {
     _suggestionsProvider = provider;
     return(This);
 }
コード例 #8
0
 private void Form1_Load(object sender, EventArgs e)
 {
     t = new Test(NrichTextBox);
     Logical.TokenGenerator.InitBox(this.NrichTextBox);
     SuggestionProvider.InitKeywordList(suggestionBox);
 }