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; } }
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()); } }
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(); }
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(); }
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); }
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(); } } }
public RequiredArgumentBuilder <TSource, T> Suggests(SuggestionProvider <TSource> provider) { _suggestionsProvider = provider; return(This); }
private void Form1_Load(object sender, EventArgs e) { t = new Test(NrichTextBox); Logical.TokenGenerator.InitBox(this.NrichTextBox); SuggestionProvider.InitKeywordList(suggestionBox); }