private void Reset() { Search = ""; FindIndicator = ""; SelectedTarget = NavigationTargets.First(); _matchingTargets.Clear(); Refresh(); }
public void GotoPrevFound() { int ixFound = _matchingTargets.IndexOf(SelectedTarget); if (ixFound > 0) { SelectedTarget = _matchingTargets[ixFound - 1]; Refresh(); } }
public void GotoNextFound() { int ixFound = _matchingTargets.IndexOf(SelectedTarget); if (ixFound >= 0 && ixFound + 1 < _matchingTargets.Count) { SelectedTarget = _matchingTargets[ixFound + 1]; Refresh(); } }
private void sm_WaitingForKey_OnEntryFrom_Char(char c) { // add char to search string // find best match //Console.WriteLine( "" ); //Console.WriteLine( "pressed " + c ); _matchingTargets = NavigationTargets.FindAll(x => x.Target.ToUpper().StartsWith(Search + c)); if (_matchingTargets.Count > 0) { NavigationTarget found = _matchingTargets.First(); //Console.WriteLine( "found " + found.Target ); Search += c; SelectedTarget = found; Refresh(); } //Console.WriteLine( "sm_OnEntry_Char() exit: " + Search ); }
private void sm_WaitingForKey_OnEntryFrom_Backspace() { if (Search == "") { return; } // remove las char from search string Search = Search.Substring(0, Search.Length - 1); //Console.WriteLine( Search ); if (Search == "") { SelectedTarget = NavigationTargets.First(); Refresh(); } else { // find best match if we still have a search string _matchingTargets = NavigationTargets.FindAll(x => x.Target.ToUpper().StartsWith(Search)); Debug.Assert(_matchingTargets.Count > 0); SelectedTarget = _matchingTargets.First(); Refresh(); } }