/// <summary> /// Opens to the given terminal page /// </summary> public void SetSelection(ModControlRoot modRoot, TerminalPageBase newPage) { listInput.SetSelection(modRoot); if (SelectedPage != newPage) { TerminalPageCategoryBase subcategory = null; bool contains = false; foreach (TerminalPageBase page in modRoot.Pages) { if (page == newPage) { contains = true; break; } } if (!contains) { foreach (TerminalPageCategoryBase cat in modRoot.Subcategories) { foreach (TerminalPageBase page in cat.Pages) { if (page == newPage) { subcategory = cat; contains = true; break; } } } } if (subcategory != null) { modRoot.SetSelection(subcategory); subcategory.SetSelection(newPage); } else { modRoot.SetSelection(newPage); } } }