private void TextBox1TextChanged(object sender, EventArgs e) { if (!_searchText) { return; } KeyTokens.Clear(); var words = textBox1.Text.Split(' '); foreach (var word in words) { if (word.Length > 0) { KeyTokens.Add(word); } } if (TokensChanged != null) { TokensChanged(); } }
/// <summary> /// down up happened successively /// </summary> internal IKey Hit(ICombination combination, Action <IKeyEventArgs> execute, Predicate <IKeyEventArgs> canExecute = null, string description = "", string stateTree = KeyStateTrees.Default) { var handling = false; IKeyEventArgs keyDownEvent = null; var token = new KeyTokens { combination.Down(e => { handling = true; keyDownEvent = e; }, canExecute, description, stateTree), combination.Up(e => { if (!handling) { Console.WriteLine($"\t{combination}_Hit Down CanExecute:false"); return; } handling = false; if (keyDownEvent == e.LastKeyDownEvent) { e.BeginInvoke(() => execute(e)); } else { Console.WriteLine($"\t{combination}_Hit: last down event is not from me, Not Execute!"); } }, canExecute, description, stateTree) }; return(token); }