static UFPlugin GetNextPlugin(UFPlugin origin) { var next = Plugins.Find(origin).Next; if (next != null) { var value = next.Value; return(value.Results.Count == 0 ? GetNextPlugin(value) : value); } return(null); }
static UFPlugin GetPreviousPlugin(UFPlugin origin) { var previous = Plugins.Find(origin).Previous; if (previous != null) { var value = previous.Value; return(value.Results.Count == 0 ? GetPreviousPlugin(value) : value); } return(null); }
internal static void SelectNextResult() { var result = Context.SelectedResult; if (result != null) { var plugin = GetPluginForResult(result); var index = plugin.Results.IndexOf(result); if (index < plugin.Results.Count - 1) { SelectResult(plugin.Results[index + 1]); } else { UFPlugin next = GetNextPlugin(plugin); if (next != null) { SelectResult(next.Results[0]); } } } }
internal static void SelectPreviousResult() { var result = Context.SelectedResult; if (result != null) { var plugin = GetPluginForResult(result); var index = plugin.Results.IndexOf(result); if (index > 0) { SelectResult(plugin.Results[index - 1]); } else { UFPlugin previous = GetPreviousPlugin(plugin); if (previous != null) { SelectResult(previous.Results[previous.Results.Count - 1]); } } } }