private void FilterAvailableCommandList(string text = null) { FilteredCommandList.Clear(); if (text == null) { text = uiFilterText.Text; } if (text.Length > 0) { int loopCount = 0; string loweredText = text.ToLower(); loopCount = AddNecessaryCommand(loopCount, loweredText, RunningAppList); loopCount = AddNecessaryCommand(loopCount, loweredText, StartMenuAppList); if (FilteredCommandList.Count < 1) { ClearIcon(); } } else { ClearIcon(); } ResetCommandSelection(); }
private int AddNecessaryCommand(int loopCount, string loweredText, CommandList list) { foreach (CommandItem app in list.Filter(loweredText)) { if (loopCount++ >= MAX_SUGGESTION) { break; } FilteredCommandList.Add(app); } return(loopCount); }