<?xml version="1.0" encoding="utf-8"?>
<Page
x:Class="HaloPixelToolBox.Backend.Views.SettingPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<Style x:Key="SettingsSectionHeaderTextBlockStyle"
BasedOn="{StaticResource BodyStrongTextBlockStyle}"
TargetType="TextBlock">
<Style.Setters>
<Setter Property="Margin" Value="1,30,0,6"/>
</Style.Setters>
</Style>
</Page.Resources>
<Grid>
<ContentDialog x:Name="cleanCacheContentDialog"
Title="清除应用缓存"
Content="是否清除应用的所有缓存文件(可以定期清理)?"
IsPrimaryButtonEnabled="True"
IsSecondaryButtonEnabled="True"
PrimaryButtonText="确定"
SecondaryButtonText="取消"
DefaultButton="Primary"/>
<ScrollView>
<StackPanel Orientation="Vertical" Spacing="4" MaxWidth="1000" HorizontalAlignment="Stretch">
<TextBlock Text="服务器与管理员" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>
<controls:SettingsCard Header="服务器地址" Description="管理端请求所使用的 API 地址">
<controls:SettingsCard.HeaderIcon>
<FontIcon Glyph=""/>
</controls:SettingsCard.HeaderIcon>
<Grid ColumnSpacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="360"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox Text="{x:Bind ViewModel.ServerAddress, Mode=TwoWay}" PlaceholderText="https://example.com/api"/>
<Button Grid.Column="1" Content="应用并重连" Command="{x:Bind ViewModel.ReconnectCommand}"/>
</Grid>
</controls:SettingsCard>
<controls:SettingsCard Header="管理员登录" Description="{x:Bind ViewModel.LoginStatusText, Mode=OneWay}">
<controls:SettingsCard.HeaderIcon>
<FontIcon Glyph=""/>
</controls:SettingsCard.HeaderIcon>
<StackPanel Width="460" Spacing="10">
<TextBox Header="账号"
Text="{x:Bind ViewModel.Account, Mode=TwoWay}"/>
<PasswordBox Header="密码"
Password="{x:Bind ViewModel.Password, Mode=TwoWay}"/>
<StackPanel Orientation="Horizontal" Spacing="10">
<Button Content="保存并登录" Command="{x:Bind ViewModel.LoginCommand}"/>
<Button Content="退出登录" Command="{x:Bind ViewModel.LogoutCommand}"/>
<ProgressRing Width="20" Height="20" IsActive="{x:Bind ViewModel.IsLoginBusy, Mode=OneWay}"/>
</StackPanel>
<TextBlock Text="首次登录成功后会使用当前 Windows 用户加密保存凭据;以后启动应用将自动登录。主动退出会清除已保存的密码。"
TextWrapping="Wrap" Opacity="0.62"/>
</StackPanel>
</controls:SettingsCard>
<TextBlock Text="外观与行为" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>
<controls:SettingsCard Header="色彩模式" Description="软件显示的主题颜色">
<controls:SettingsCard.HeaderIcon>
<FontIcon Glyph=""/>
</controls:SettingsCard.HeaderIcon>
<ComboBox x:Name="appThemeComboBox" Tag="HaloPixelToolBox.Backend.Profiles.CrossVersionProfiles.SystemProfile.Theme">
<ComboBoxItem Content="浅色" Tag="Light"/>
<ComboBoxItem Content="深色" Tag="Dark"/>
<ComboBoxItem Content="跟随系统" Tag="Default"/>
</ComboBox>
</controls:SettingsCard>
<TextBlock Text="通用" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>
<controls:SettingsCard Header="自启动" Description="开机之后自动启动应用">
<controls:SettingsCard.HeaderIcon>
<FontIcon Glyph=""/>
</controls:SettingsCard.HeaderIcon>
<ToggleSwitch x:Name="autoStartToggleSwitch" IsOn="{x:Bind ViewModel.IsAutoStartEnable, Mode=TwoWay}"/>
</controls:SettingsCard>
<TextBlock Text="路径与存储" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>
<controls:SettingsCard Header="缓存目录"
Description="{x:Bind ViewModel.AppCacheDirectory, Mode=OneWay}"
IsClickEnabled="True"
Command="{x:Bind ViewModel.OpenPathCommand}"
CommandParameter="{x:Bind ViewModel.AppCacheDirectory, Mode=OneWay}">
<controls:SettingsCard.ActionIcon>
<FontIcon Glyph=""/>
</controls:SettingsCard.ActionIcon>
<Grid ColumnSpacing="20">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Style="{ThemeResource CaptionTextBlockStyle}"
Text="{x:Bind ViewModel.AppCacheSize, Mode=OneWay}"
VerticalAlignment="Center"/>
<Button Grid.Column="1" Content="清除缓存" Command="{x:Bind ViewModel.ClearCacheCommand}"/>
</Grid>
</controls:SettingsCard>
</StackPanel>
</ScrollView>
</Grid>
</Page>
<?xml version="1.0" encoding="utf-8"?>
<Page
x:Class="HaloPixelToolBox.Backend.Views.SettingPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<Style x:Key="SettingsSectionHeaderTextBlockStyle"
BasedOn="{StaticResource BodyStrongTextBlockStyle}"
TargetType="TextBlock">
<Style.Setters>
<Setter Property="Margin" Value="1,30,0,6"/>
</Style.Setters>
</Style>
</Page.Resources>
<Grid>
<ContentDialog x:Name="cleanCacheContentDialog"
Title="清除应用缓存"
Content="是否清除应用的所有缓存文件(可以定期清理)?"
IsPrimaryButtonEnabled="True"
IsSecondaryButtonEnabled="True"
PrimaryButtonText="确定"
SecondaryButtonText="取消"
DefaultButton="Primary"/>
<ScrollView>
<StackPanel Orientation="Vertical" Spacing="4" MaxWidth="1000" HorizontalAlignment="Stretch">
<TextBlock Text="服务器与管理员" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>
<controls:SettingsCard Header="服务器地址" Description="管理端请求所使用的 API 地址">
<controls:SettingsCard.HeaderIcon>
<FontIcon Glyph=""/>
</controls:SettingsCard.HeaderIcon>
<Grid ColumnSpacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="360"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox Text="{x:Bind ViewModel.ServerAddress, Mode=TwoWay}" PlaceholderText="https://example.com/api"/>
<Button Grid.Column="1" Content="应用并重连" Command="{x:Bind ViewModel.ReconnectCommand}"/>
</Grid>
</controls:SettingsCard>
<controls:SettingsCard Header="管理员登录" Description="{x:Bind ViewModel.LoginStatusText, Mode=OneWay}">
<controls:SettingsCard.HeaderIcon>
<FontIcon Glyph=""/>
</controls:SettingsCard.HeaderIcon>
<StackPanel Width="460" Spacing="10">
<TextBox Header="账号"
Text="{x:Bind ViewModel.Account, Mode=TwoWay}"/>
<PasswordBox Header="密码"
Password="{x:Bind ViewModel.Password, Mode=TwoWay}"/>
<StackPanel Orientation="Horizontal" Spacing="10">
<Button Content="保存并登录" Command="{x:Bind ViewModel.LoginCommand}"/>
<Button Content="退出登录" Command="{x:Bind ViewModel.LogoutCommand}"/>
<ProgressRing Width="20" Height="20" IsActive="{x:Bind ViewModel.IsLoginBusy, Mode=OneWay}"/>
</StackPanel>
<TextBlock Text="首次登录成功后会使用当前 Windows 用户加密保存凭据;以后启动应用将自动登录。主动退出会清除已保存的密码。"
TextWrapping="Wrap" Opacity="0.62"/>
</StackPanel>
</controls:SettingsCard>
<TextBlock Text="外观与行为" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>
<controls:SettingsCard Header="色彩模式" Description="软件显示的主题颜色">
<controls:SettingsCard.HeaderIcon>
<FontIcon Glyph=""/>
</controls:SettingsCard.HeaderIcon>
<ComboBox x:Name="appThemeComboBox" Tag="HaloPixelToolBox.Backend.Profiles.CrossVersionProfiles.SystemProfile.Theme">
<ComboBoxItem Content="浅色" Tag="Light"/>
<ComboBoxItem Content="深色" Tag="Dark"/>
<ComboBoxItem Content="跟随系统" Tag="Default"/>
</ComboBox>
</controls:SettingsCard>
<TextBlock Text="通用" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>
<controls:SettingsCard Header="自启动" Description="开机之后自动启动应用">
<controls:SettingsCard.HeaderIcon>
<FontIcon Glyph=""/>
</controls:SettingsCard.HeaderIcon>
<ToggleSwitch x:Name="autoStartToggleSwitch" IsOn="{x:Bind ViewModel.IsAutoStartEnable, Mode=TwoWay}"/>
</controls:SettingsCard>
<TextBlock Text="路径与存储" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>
<controls:SettingsCard Header="缓存目录"
Description="{x:Bind ViewModel.AppCacheDirectory, Mode=OneWay}"
IsClickEnabled="True"
Command="{x:Bind ViewModel.OpenPathCommand}"
CommandParameter="{x:Bind ViewModel.AppCacheDirectory, Mode=OneWay}">
<controls:SettingsCard.ActionIcon>
<FontIcon Glyph=""/>
</controls:SettingsCard.ActionIcon>
<Grid ColumnSpacing="20">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Style="{ThemeResource CaptionTextBlockStyle}"
Text="{x:Bind ViewModel.AppCacheSize, Mode=OneWay}"
VerticalAlignment="Center"/>
<Button Grid.Column="1" Content="清除缓存" Command="{x:Bind ViewModel.ClearCacheCommand}"/>
</Grid>
</controls:SettingsCard>
</StackPanel>
</ScrollView>
</Grid>
</Page>