diff --git a/App.xaml.cs b/App.xaml.cs index 79b2eef..e5f2e92 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -147,7 +147,7 @@ public partial class App : Microsoft.UI.Xaml.Application } catch (Exception ex) { - + Debug.WriteLine("发生未知错误: " + ex.Message); } }).Start(); diff --git a/Editor/EditorWin.xaml b/Editor/EditorWin.xaml index fbe17d5..fc29f43 100644 --- a/Editor/EditorWin.xaml +++ b/Editor/EditorWin.xaml @@ -81,11 +81,11 @@ VerticalScrollBarVisibility="Auto"> @@ -109,7 +109,9 @@ x:Name="tabview" Grid.Row="0" Height="auto" - IsAddTabButtonVisible="False" /> + AddTabButtonClick="MyTabView_AddTabButtonClick" + IsAddTabButtonVisible="False" + TabCloseRequested="MyTabView_TabCloseRequested" /> diff --git a/Editor/EditorWin.xaml.cs b/Editor/EditorWin.xaml.cs index b56e913..9da7e9d 100644 --- a/Editor/EditorWin.xaml.cs +++ b/Editor/EditorWin.xaml.cs @@ -88,6 +88,23 @@ public sealed partial class EditorWin : WindowEx } - + // ѡ + private void MyTabView_AddTabButtonClick(TabView sender, object args) + { + var newTab = new TabViewItem + { + Header = $"New Tab {TabViewList.Count + 1}", + Content = new TextBlock { Text = "This is a new tab." } + }; + TabViewList.Add(newTab); + } + // رѡ + private void MyTabView_TabCloseRequested(TabView sender, TabViewTabCloseRequestedEventArgs args) + { + if (args.Tab is TabViewItem tab) + { + TabViewList.Remove(tab); + } + } } diff --git a/RustTools.csproj b/RustTools.csproj index 05963a0..33d9574 100644 --- a/RustTools.csproj +++ b/RustTools.csproj @@ -33,21 +33,24 @@ - + - - + + Always - + - + \ No newline at end of file