From cfdca6f031c6fe891818fe5b103ce7c57e55b6e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AD=B1=E5=82=91?= Date: Fri, 13 Oct 2023 23:09:05 +0800 Subject: [PATCH] Fix nav error --- Source/GrasscutterTools/Forms/FormMain.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Source/GrasscutterTools/Forms/FormMain.cs b/Source/GrasscutterTools/Forms/FormMain.cs index ffae358..89f4fc6 100644 --- a/Source/GrasscutterTools/Forms/FormMain.cs +++ b/Source/GrasscutterTools/Forms/FormMain.cs @@ -754,16 +754,10 @@ namespace GrasscutterTools.Forms /// 如果导航到了则返回页面实例,否则返回空 public TPage NavigateTo() where TPage : BasePage { - for (var i = 0; i < TCMain.TabPages.Count; i++) - { - if (TCMain.TabPages[i].Controls[0] is TPage page) - { - ListPages.SelectedIndex = i; - return page; - } - } - - return null; + ListPages.SelectedIndex = -1; + var page = Pages[typeof(TPage).Name]; + TCMain.SelectedTab = page.Parent as TabPage; + return page as TPage; } #endregion - 通用 General -