更新异常处理、控件属性和事件处理程序
在 `App.xaml.cs` 文件中,捕获 `Exception` 异常时,添加了调试输出信息,输出内容为“发生未知错误: ”加上异常信息。 在 `EditorWin.xaml` 文件中,将 `TreeView` 的 `CanReorderItems` 属性从 `True` 修改为 `False`。 在 `EditorWin.xaml` 文件中,`TabView` 控件添加了 `AddTabButtonClick` 和 `TabCloseRequested` 事件处理程序,并将 `IsAddTabButtonVisible` 属性设置为 `False`。 在 `EditorWin.xaml.cs` 文件中,添加了 `MyTabView_AddTabButtonClick` 和 `MyTabView_TabCloseRequested` 方法,用于处理添加和关闭选项卡的事件。 在 `RustTools.csproj` 文件中,调整了注释的格式,使其在 VS Code 中显示正确的图标,并调整了 `ItemGroup` 的格式。
This commit is contained in:
parent
8124c800a8
commit
f21ffd521a
|
@ -81,11 +81,11 @@
|
||||||
VerticalScrollBarVisibility="Auto">
|
VerticalScrollBarVisibility="Auto">
|
||||||
<!--
|
<!--
|
||||||
TreeView 绑定资源和拖放事件
|
TreeView 绑定资源和拖放事件
|
||||||
CanReorderItems="True"
|
|
||||||
-->
|
-->
|
||||||
<controlpages:EditorTreeView
|
<controlpages:EditorTreeView
|
||||||
x:Name="treeView"
|
x:Name="treeView"
|
||||||
AllowDrop="True"
|
AllowDrop="True"
|
||||||
|
CanReorderItems="False"
|
||||||
ItemTemplateSelector="{StaticResource ExplorerItemTemplateSelector}"
|
ItemTemplateSelector="{StaticResource ExplorerItemTemplateSelector}"
|
||||||
ItemsSource="{x:Bind DataSource}"
|
ItemsSource="{x:Bind DataSource}"
|
||||||
SelectionMode="Single" />
|
SelectionMode="Single" />
|
||||||
|
@ -109,7 +109,9 @@
|
||||||
x:Name="tabview"
|
x:Name="tabview"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Height="auto"
|
Height="auto"
|
||||||
IsAddTabButtonVisible="False" />
|
AddTabButtonClick="MyTabView_AddTabButtonClick"
|
||||||
|
IsAddTabButtonVisible="False"
|
||||||
|
TabCloseRequested="MyTabView_TabCloseRequested" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,20 +33,23 @@
|
||||||
<PackageReference Include="WinUIEx" Version="2.3.2" />
|
<PackageReference Include="WinUIEx" Version="2.3.2" />
|
||||||
|
|
||||||
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.7" />
|
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.0.7" />
|
||||||
<!--<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240227000" />-->
|
<!--<PackageReference
|
||||||
|
Include="Microsoft.WindowsAppSDK" Version="1.5.240227000" />-->
|
||||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" />
|
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" />
|
||||||
|
|
||||||
<Manifest Include="$(ApplicationManifest)" />
|
<Manifest Include="$(ApplicationManifest)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!--在vs code 中必须加上不然没有任何图标-->
|
<!--在vs
|
||||||
|
code 中必须加上不然没有任何图标-->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Assets\**">
|
<Content Include="Assets\**">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
|
<ItemGroup
|
||||||
|
Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
|
||||||
<ProjectCapability Include="Msix" />
|
<ProjectCapability Include="Msix" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user