Files
community/Ink Canvas/Windows/SettingsViews/SettingsViews/UpdateCenterPanel.xaml
T
2026-01-11 08:23:09 +08:00

130 lines
8.8 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"
mc:Ignorable="d"
d:DesignHeight="950" d:DesignWidth="640">
<UserControl.Resources>
<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>
<Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="IsTabStop" Value="false"/>
<EventSetter Event="PreviewMouseDown" Handler="ScrollbarThumb_MouseDown"/>
<EventSetter Event="PreviewMouseUp" Handler="ScrollbarThumb_MouseUp"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Border Name="ScrollbarThumbEx"
SnapsToDevicePixels="True"
Background="#c3c3c3"
Opacity="0.5"
CornerRadius="1.5"
Height="{TemplateBinding Height}"
Width="3" HorizontalAlignment="Center"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type ScrollBar}">
<EventSetter Event="Scroll" Handler="ScrollBar_Scroll"/>
<Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
<Setter Property="Width" Value="8"/>
<Setter Property="Margin" Value="-6 3 0 0" />
<Setter Property="MinWidth" Value="{Binding Height, RelativeSource={RelativeSource Self}}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}">
<Grid x:Name="ScrollbarGrid" SnapsToDevicePixels="true">
<Border Width="3" CornerRadius="1.5" Background="#e0e0e0" Opacity="0" IsHitTestVisible="False" Margin="0 4 -2 4" x:Name="ScrollBarBorderTrackBackground"/>
<Border Padding="0 4" Background="Transparent" MouseEnter="ScrollBarTrack_MouseEnter"
MouseLeave="ScrollBarTrack_MouseLeave">
<Track x:Name="PART_Track"
IsDirectionReversed="true"
IsEnabled="True"
Width="6"
Margin="0,0,0,0"
HorizontalAlignment="Right">
<Track.DecreaseRepeatButton>
<RepeatButton Opacity="0" Command="{x:Static ScrollBar.PageUpCommand}" />
</Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton>
<RepeatButton Opacity="0" Command="{x:Static ScrollBar.PageDownCommand}" />
</Track.IncreaseRepeatButton>
<Track.Thumb>
<Thumb Style="{StaticResource ScrollBarThumb }" />
</Track.Thumb>
</Track>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</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">
<StackPanel Margin="60,24,60,24">
<TextBlock Foreground="#2e3436" FontSize="28" FontWeight="Bold" Text="InkCanvasForClass 更新" Margin="0,0,0,24"/>
<Border BorderBrush="#e6e6e6" BorderThickness="1" CornerRadius="8" Padding="20" Background="#FAFAFA" 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"/>
</StackPanel>
</Border>
<StackPanel Orientation="Horizontal" Margin="0,0,0,24" VerticalAlignment="Center">
<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>
<StackPanel Orientation="Horizontal" Margin="0,0,0,24">
<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,0,12,0">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4" Padding="{TemplateBinding Padding}">
<StackPanel Orientation="Horizontal">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Path Name="ChevronIcon" Data="M 0 0 L 4 4 L 0 8" Stroke="{TemplateBinding Foreground}" StrokeThickness="1.5" Margin="8,0,0,0" VerticalAlignment="Center" Visibility="Collapsed"/>
</StackPanel>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
</StackPanel>
<StackPanel Name="UpdateAvailablePanel" Visibility="Collapsed" Margin="0,0,0,24">
<Border BorderBrush="#e6e6e6" BorderThickness="1" CornerRadius="8" Padding="16" Background="#F9F9F9">
<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"/>
<Button Name="UpdateNowButton" Content="立即更新" HorizontalAlignment="Left" Padding="20,10" FontSize="14" Cursor="Hand" Click="UpdateNowButton_Click" Background="#0078D4" Foreground="White" BorderThickness="0">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="4" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
</StackPanel>
</Border>
</StackPanel>
</StackPanel>
</ScrollViewer>
</Grid>
</UserControl>