private void OnConsoleCommandEntered(object textObject) { string text = textObject as string; if (SelectedConsoleSuggestion != -1) { ConsoleInputText = m_rawConsoleSuggestions[SelectedConsoleSuggestion]; SelectedConsoleSuggestion = -1; ConsoleView.SelectEndOfConsoleInput(); OnUpdateSuggestions(ConsoleInputText); } else if (text.StartsWith("?")) { string argument = ConsoleUtility.GetConsoleStringArgument(text.Substring(1), 0); if (argument != null) { LogUtility.Log("----------------------------------"); LogUtility.Log("Suggestions for search term '{0}':", argument); List <string> suggestions = new List <string>(); CConfigManager.Instance.GetConsoleSuggestionsContainingString(argument, ref suggestions); foreach (string suggestion in suggestions) { LogUtility.Log(suggestion); } ConsoleInputText = ""; } } else { ConsoleUtility.ProcessConsoleString(text); ConsoleInputText = ""; OnClearSuggestions(null); } }
private void OnUpdateSuggestions(object arg) { if (arg is string argument) { if (string.IsNullOrWhiteSpace(argument)) { OnClearSuggestions(null); } else { string firstArgument = ConsoleUtility.GetConsoleStringArgument(argument, 0); if (firstArgument != null) { CConfigManager.Instance.GetConsoleSuggestions(firstArgument, ref m_consoleSuggestions, ref m_rawConsoleSuggestions); RaisePropertyChanged(nameof(ConsoleSuggestions)); } } } SelectedConsoleSuggestion = -1; }