Files
community/Ink Canvas/Windows/SettingsViews/SettingsViews/UpdateCenterPanel.xaml
T
2026-03-28 20:20:44 +08:00

359 lines
32 KiB
XML

<UserControl x:Class="Ink_Canvas.Windows.SettingsViews.UpdateCenterPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Ink_Canvas.Windows.SettingsViews"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
xmlns:mdxam="clr-namespace:MdXaml;assembly=MdXaml"
mc:Ignorable="d"
d:DesignHeight="950" d:DesignWidth="640">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ComboBoxStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="ToggleSwitchStyle" TargetType="Border">
<Setter Property="Width" Value="48"/>
<Setter Property="Height" Value="25"/>
<Setter Property="CornerRadius" Value="12"/>
<Setter Property="Padding" Value="3,0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Margin" Value="0,0,15,0"/>
</Style>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<ScrollViewer ScrollChanged="ScrollViewerEx_ScrollChanged" IsManipulationEnabled="True" Name="UpdateCenterScrollViewerEx" IsDeferredScrollingEnabled="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Disabled" IsTabStop="False" TabIndex="-1" Margin="0,0,2,2" PanningMode="VerticalOnly">
<StackPanel Margin="60,12,60,24">
<TextBlock Foreground="#2e3436" FontSize="28" FontWeight="Bold" Text="更新中心" Margin="0,0,0,24"/>
<StackPanel Orientation="Horizontal" Margin="0,0,0,20">
<Border x:Name="TabUpdate" Padding="20,12" CornerRadius="8,8,0,0" Cursor="Hand" MouseLeftButtonDown="Tab_Click" Tag="Update" Background="#e1e1e1">
<TextBlock Foreground="#2e3436" FontSize="16" FontWeight="Bold" Text="更新"/>
</Border>
<Border x:Name="TabRollback" Padding="20,12" CornerRadius="8,8,0,0" Cursor="Hand" MouseLeftButtonDown="Tab_Click" Tag="Rollback" Background="Transparent" Margin="2,0,0,0">
<TextBlock Foreground="#2e3436" FontSize="16" Text="回滚"/>
</Border>
<Border x:Name="TabSettings" Padding="20,12" CornerRadius="8,8,0,0" Cursor="Hand" MouseLeftButtonDown="Tab_Click" Tag="Settings" Background="Transparent" Margin="2,0,0,0">
<TextBlock Foreground="#2e3436" FontSize="16" Text="设置"/>
</Border>
</StackPanel>
<Border BorderBrush="#e6e6e6" BorderThickness="1.25,1.25,1.25,4" CornerRadius="0,8,8,8" Background="#FAFAFA">
<StackPanel>
<StackPanel x:Name="UpdateTabContent" Margin="18,18,18,18">
<Border BorderBrush="#e6e6e6" BorderThickness="1" CornerRadius="8" Padding="20" Background="#FFFFFF" Margin="0,0,0,20">
<StackPanel>
<TextBlock Name="UpdateStatusText" Foreground="#2e3436" FontSize="18" FontWeight="SemiBold" Text="正在检查更新..." TextWrapping="Wrap" Margin="0,0,0,8"/>
<TextBlock Name="LastCheckTimeText" Foreground="#878787" FontSize="14" Text="上次检查时间: 从未" TextWrapping="Wrap" Margin="0,0,0,8"/>
<StackPanel Orientation="Horizontal" Margin="0,0,0,8">
<TextBlock Name="CurrentVersionText" Foreground="#878787" FontSize="14" Text="当前版本: 正在获取..." TextWrapping="Wrap" VerticalAlignment="Center"/>
<ui:ProgressRing Name="LoadingSpinner" Width="16" Height="16" IsActive="False" Margin="12,0,0,0" VerticalAlignment="Center"/>
</StackPanel>
<Button Name="CheckUpdateButton" Content="检查更新" HorizontalAlignment="Left" Padding="20,10" FontSize="14" Cursor="Hand" Click="CheckUpdateButton_Click" Background="#F3F3F3" Foreground="#2e3436" BorderThickness="1" BorderBrush="#E1E1E1" Margin="0,8,0,0">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
</StackPanel>
</Border>
<StackPanel Name="UpdateAvailablePanel" Visibility="Collapsed" Margin="0,0,0,20">
<Border x:Name="UpdateAvailableBorder" BorderThickness="1" CornerRadius="8" Padding="16">
<StackPanel>
<TextBlock Foreground="#2e3436" FontSize="16" FontWeight="SemiBold" Text="可用更新" Margin="0,0,0,8"/>
<TextBlock Name="LatestVersionText" Foreground="#878787" FontSize="14" Text="" TextWrapping="Wrap" Margin="0,0,0,16"/>
<ikw:SimpleStackPanel Orientation="Vertical" Spacing="12">
<Button Name="UpdateNowButton" Content="立即下载并安装" HorizontalAlignment="Left" Padding="20,10" FontSize="14" FontWeight="SemiBold" Cursor="Hand" Click="UpdateNowButton_Click" Background="#2563eb" Foreground="White" BorderThickness="0" Height="40" MinWidth="200">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="6" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#1d4ed8"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#1e40af"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="#9ca3af"/>
<Setter Property="Foreground" Value="#d1d5db"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Name="UpdateLaterButton" Content="下载并在软件关闭时安装" HorizontalAlignment="Left" Padding="20,10" FontSize="14" FontWeight="Medium" Cursor="Hand" Click="UpdateLaterButton_Click" BorderThickness="1" Height="40" MinWidth="200">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="6" Padding="{TemplateBinding Padding}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="#2563eb" Opacity="0.1"/>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="#2563eb" Opacity="0.2"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button Name="SkipVersionButton" Content="跳过该版本" HorizontalAlignment="Left" Padding="20,10" FontSize="14" FontWeight="Medium" Cursor="Hand" Click="SkipVersionButton_Click" Background="Transparent" BorderThickness="0" Height="40" MinWidth="200">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="6" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="#2563eb" Opacity="0.1"/>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="#2563eb" Opacity="0.2"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
</ikw:SimpleStackPanel>
</StackPanel>
</Border>
</StackPanel>
<Border BorderBrush="#e6e6e6" BorderThickness="1" CornerRadius="8" Padding="16" Background="#FFFFFF" Margin="0,0,0,20">
<StackPanel>
<TextBlock Foreground="#2e3436" FontSize="16" FontWeight="SemiBold" Text="更新日志" Margin="0,0,0,12"/>
<ScrollViewer MaxHeight="300" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<mdxam:MarkdownScrollViewer x:Name="UpdateLogViewer" Markdown="暂无更新日志" />
</ScrollViewer>
</StackPanel>
</Border>
<Grid Height="54" Margin="0,0,0,16">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0" MaxWidth="350">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="软件架构" HorizontalAlignment="Left"/>
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择更新架构" HorizontalAlignment="Left" TextWrapping="Wrap"/>
</StackPanel>
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Grid.Column="1">
<Border x:Name="UpdateArchX86Border" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="UpdateArch_X86" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="32 位 (x86)"/>
</Border>
<Border x:Name="UpdateArchX64Border" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="UpdateArch_X64" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
<TextBlock Foreground="#2e3436" FontSize="14" Text="64 位 (x64)"/>
</Border>
</WrapPanel>
</Grid>
<Grid Height="54">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="0" MaxWidth="350">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="更新通道" HorizontalAlignment="Left"/>
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择更新通道:稳定版提供可靠更新,预览版提供新功能体验,测试版提供新功能抢先体验" HorizontalAlignment="Left" TextWrapping="Wrap"/>
</StackPanel>
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Grid.Column="1">
<Border x:Name="UpdateChannelReleaseBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="UpdateChannel_Release" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="稳定版"/>
</Border>
<Border x:Name="UpdateChannelPreviewBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="UpdateChannel_Preview" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
<TextBlock Foreground="#2e3436" FontSize="14" Text="预览版"/>
</Border>
<Border x:Name="UpdateChannelBetaBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="UpdateChannel_Beta" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
<TextBlock Foreground="#2e3436" FontSize="14" Text="测试版"/>
</Border>
</WrapPanel>
</Grid>
</StackPanel>
<StackPanel x:Name="RollbackTabContent" Visibility="Collapsed" Margin="18,18,18,18">
<Border BorderBrush="#e6e6e6" BorderThickness="1" CornerRadius="8" Padding="16" Background="#FFFFFF" Margin="0,0,0,20">
<StackPanel>
<TextBlock Foreground="#2e3436" FontSize="16" FontWeight="SemiBold" Text="历史版本" Margin="0,0,0,12"/>
<ScrollViewer MaxHeight="300" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<mdxam:MarkdownScrollViewer x:Name="HistoryLogViewer" Markdown="正在加载历史版本..." />
</ScrollViewer>
</StackPanel>
</Border>
<Grid Height="54" Margin="0,0,0,20">
<StackPanel Orientation="Vertical" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="选择回滚版本" HorizontalAlignment="Left"/>
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择要回滚到的历史版本" HorizontalAlignment="Left"/>
</StackPanel>
<ComboBox x:Name="RollbackVersionComboBox"
Style="{StaticResource ComboBoxStyle}"
ItemContainerStyle="{StaticResource ComboBoxItemStyle}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Width="200"
Margin="0,0,15,0"
SelectionChanged="RollbackVersionComboBox_SelectionChanged"/>
</Grid>
<Grid Height="54" Margin="0,0,0,20">
<StackPanel Orientation="Vertical" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="回滚到选中版本" HorizontalAlignment="Left"/>
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="回滚到下拉框中选择的版本" HorizontalAlignment="Left"/>
</StackPanel>
<Button x:Name="RollbackButton" Content="回滚" Width="120" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Padding="12,6" Click="RollbackButton_Click"/>
</Grid>
<Grid Height="54">
<StackPanel Orientation="Vertical" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="版本修复" HorizontalAlignment="Left"/>
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="根据当前选择的通道下载最新版本并执行安装,可用于修复损坏的安装" HorizontalAlignment="Left"/>
</StackPanel>
<Button x:Name="FixVersionButton" Content="版本修复" Width="120" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0" Padding="12,6" Click="FixVersionButton_Click"/>
</Grid>
</StackPanel>
<StackPanel x:Name="SettingsTabContent" Visibility="Collapsed" Margin="18,18,18,18">
<Grid Height="54">
<StackPanel Orientation="Vertical" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="自动检查更新" HorizontalAlignment="Left"/>
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="定期检查是否有新版本可用" HorizontalAlignment="Left"/>
</StackPanel>
<Border x:Name="ToggleSwitchIsAutoUpdate" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsAutoUpdate" MouseLeftButtonDown="ToggleSwitch_Click">
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
<Border.Effect>
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
</Border.Effect>
</Border>
</Border>
</Grid>
<Border Height="1" Background="#ebebeb" Margin="0,0,0,0"/>
<Grid Height="54" x:Name="AutoUpdateWithSilencePanel">
<StackPanel Orientation="Vertical" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="静默更新" HorizontalAlignment="Left"/>
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="在软件不使用时自动安装更新,无需手动操作" HorizontalAlignment="Left"/>
</StackPanel>
<Border x:Name="ToggleSwitchIsAutoUpdateWithSilence" Style="{StaticResource ToggleSwitchStyle}" Background="#3584e4" Tag="IsAutoUpdateWithSilence" MouseLeftButtonDown="ToggleSwitch_Click">
<Border Width="19" Height="19" Background="White" CornerRadius="10" HorizontalAlignment="Right" VerticalAlignment="Center">
<Border.Effect>
<DropShadowEffect BlurRadius="4" Direction="-45" Color="Black" Opacity="0.3" ShadowDepth="0"/>
</Border.Effect>
</Border>
</Border>
</Grid>
<Border Height="1" Background="#ebebeb" Margin="0,0,0,0" x:Name="AutoUpdateTimePeriodSeparator"/>
<Grid Margin="0,12,0,12" x:Name="AutoUpdateTimePeriodBlock">
<StackPanel>
<TextBlock Text="静默更新时间段" FontSize="15" FontWeight="Bold" Foreground="#2e3436" Margin="0,0,0,12"/>
<StackPanel>
<StackPanel Orientation="Vertical" Margin="0,0,0,12">
<TextBlock Text="起始时间" FontSize="14" Foreground="#2e3436" Margin="0,0,0,8"/>
<ComboBox x:Name="AutoUpdateWithSilenceStartTimeComboBox"
Style="{StaticResource ComboBoxStyle}"
ItemContainerStyle="{StaticResource ComboBoxItemStyle}"
HorizontalAlignment="Left"
Width="150"
SelectedIndex="6"
SelectionChanged="AutoUpdateWithSilenceStartTimeComboBox_SelectionChanged">
<ComboBoxItem Content="00:00" Tag="00"/>
<ComboBoxItem Content="01:00" Tag="01"/>
<ComboBoxItem Content="02:00" Tag="02"/>
<ComboBoxItem Content="03:00" Tag="03"/>
<ComboBoxItem Content="04:00" Tag="04"/>
<ComboBoxItem Content="05:00" Tag="05"/>
<ComboBoxItem Content="06:00" Tag="06" IsSelected="True"/>
<ComboBoxItem Content="07:00" Tag="07"/>
<ComboBoxItem Content="08:00" Tag="08"/>
<ComboBoxItem Content="09:00" Tag="09"/>
<ComboBoxItem Content="10:00" Tag="10"/>
<ComboBoxItem Content="11:00" Tag="11"/>
<ComboBoxItem Content="12:00" Tag="12"/>
<ComboBoxItem Content="13:00" Tag="13"/>
<ComboBoxItem Content="14:00" Tag="14"/>
<ComboBoxItem Content="15:00" Tag="15"/>
<ComboBoxItem Content="16:00" Tag="16"/>
<ComboBoxItem Content="17:00" Tag="17"/>
<ComboBoxItem Content="18:00" Tag="18"/>
<ComboBoxItem Content="19:00" Tag="19"/>
<ComboBoxItem Content="20:00" Tag="20"/>
<ComboBoxItem Content="21:00" Tag="21"/>
<ComboBoxItem Content="22:00" Tag="22"/>
<ComboBoxItem Content="23:00" Tag="23"/>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="0,0,0,0">
<TextBlock Text="终止时间" FontSize="14" Foreground="#2e3436" Margin="0,0,0,8"/>
<ComboBox x:Name="AutoUpdateWithSilenceEndTimeComboBox"
Style="{StaticResource ComboBoxStyle}"
ItemContainerStyle="{StaticResource ComboBoxItemStyle}"
HorizontalAlignment="Left"
Width="150"
SelectedIndex="22"
SelectionChanged="AutoUpdateWithSilenceEndTimeComboBox_SelectionChanged">
<ComboBoxItem Content="00:00" Tag="00"/>
<ComboBoxItem Content="01:00" Tag="01"/>
<ComboBoxItem Content="02:00" Tag="02"/>
<ComboBoxItem Content="03:00" Tag="03"/>
<ComboBoxItem Content="04:00" Tag="04"/>
<ComboBoxItem Content="05:00" Tag="05"/>
<ComboBoxItem Content="06:00" Tag="06"/>
<ComboBoxItem Content="07:00" Tag="07"/>
<ComboBoxItem Content="08:00" Tag="08"/>
<ComboBoxItem Content="09:00" Tag="09"/>
<ComboBoxItem Content="10:00" Tag="10"/>
<ComboBoxItem Content="11:00" Tag="11"/>
<ComboBoxItem Content="12:00" Tag="12"/>
<ComboBoxItem Content="13:00" Tag="13"/>
<ComboBoxItem Content="14:00" Tag="14"/>
<ComboBoxItem Content="15:00" Tag="15"/>
<ComboBoxItem Content="16:00" Tag="16"/>
<ComboBoxItem Content="17:00" Tag="17"/>
<ComboBoxItem Content="18:00" Tag="18"/>
<ComboBoxItem Content="19:00" Tag="19"/>
<ComboBoxItem Content="20:00" Tag="20"/>
<ComboBoxItem Content="21:00" Tag="21"/>
<ComboBoxItem Content="22:00" Tag="22" IsSelected="True"/>
<ComboBoxItem Content="23:00" Tag="23"/>
</ComboBox>
</StackPanel>
</StackPanel>
<TextBlock Margin="0,8,0,0" Text="若终止时间小于起始时间,即将终止时间视为第二天的时间。若起始时间与终止时间相同,即视为全天候时间。"
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11"/>
</StackPanel>
</Grid>
</StackPanel>
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
</Grid>
</UserControl>