添加设置页面及多语言支持功能
在 `MainWindow.xaml` 中添加了设置页面的 TabItem,并引入了 `BooleanToVisibilityConverter` 以控制多语言按钮的可见性。 在 `MainWindowViewModel.cs` 中新增 `_multipleLangSupport` 属性,并在加载任务时更新其值。 创建了新的 `SettingsPage.xaml` 页面,包含基本的 UI 元素。 在 `SettingsPage.xaml.cs` 中实现了页面的构造函数,确保组件正确初始化。
This commit is contained in:
parent
c59bb3e007
commit
81894143c9
|
@ -5,6 +5,7 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:MCI18n"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:page="clr-namespace:MCI18n.Pages"
|
||||
Title="SNBT编辑器"
|
||||
Width="900"
|
||||
Height="600"
|
||||
|
@ -12,6 +13,9 @@
|
|||
Foreground="White"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Window.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
</Window.Resources>
|
||||
<Window.DataContext>
|
||||
<local:MainWindowViewModel />
|
||||
</Window.DataContext>
|
||||
|
@ -49,8 +53,11 @@
|
|||
Command="{Binding SaveQuestCommand}"
|
||||
Content="打包"
|
||||
IsEnabled="False" />
|
||||
<StackPanel Visibility="{}">
|
||||
|
||||
<StackPanel Visibility="{Binding MultipleLangSupport, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Button
|
||||
Width="100"
|
||||
Height="30"
|
||||
Content="多语言" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<TabControl Grid.Row="1">
|
||||
|
@ -127,6 +134,9 @@
|
|||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="战利品列表" />
|
||||
<TabItem Header="设置">
|
||||
<Frame Source="Pages/SettingsPage.xaml" />
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<!-- 状态栏
|
||||
<StatusBar Grid.Row="2" Background="Transparent">
|
||||
|
|
|
@ -36,6 +36,8 @@ namespace MCI18n
|
|||
[ObservableProperty]
|
||||
private bool _loading = false;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _multipleLangSupport;
|
||||
|
||||
[RelayCommand]
|
||||
private void LoadQuests()
|
||||
|
@ -61,6 +63,7 @@ namespace MCI18n
|
|||
Chapters.Add(chapter);
|
||||
}
|
||||
}
|
||||
MultipleLangSupport = GlobalContext.MultipleLangSupport;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<Page
|
||||
x:Class="MCI18n.Pages.SettingsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:MCI18n.Pages"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="SettingsPage"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
<TextBlock Text="Settings..." />
|
||||
</Grid>
|
||||
</Page>
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace MCI18n.Pages
|
||||
{
|
||||
/// <summary>
|
||||
/// SettingsPage.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SettingsPage : Page
|
||||
{
|
||||
public SettingsPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue