Files
qhmes/yy-admin-master/YY.Admin/Views/UpdateWindow.xaml

267 lines
12 KiB
XML

<hc:Window x:Class="YY.Admin.Views.UpdateWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:ctls="clr-namespace:YY.Admin.Core.Controls;assembly=YY.Admin.Core"
Width="520"
Height="480"
WindowStartupLocation="CenterOwner"
ResizeMode="NoResize"
Background="White"
BorderBrush="#f0f0f0"
BorderThickness="1"
Title="发现新版本">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="UpdatePrimaryButton" TargetType="Button" BasedOn="{StaticResource ButtonPrimary}">
<Setter Property="Background" Value="#1890ff"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Height" Value="36"/>
<Setter Property="Width" Value="100"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Cursor" Value="Hand"/>
</Style>
<Style x:Key="UpdateSecondaryButton" TargetType="Button" BasedOn="{StaticResource ButtonDefault}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="#666666"/>
<Setter Property="BorderBrush" Value="#d9d9d9"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Height" Value="36"/>
<Setter Property="Width" Value="100"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Cursor" Value="Hand"/>
</Style>
</ResourceDictionary>
</Window.Resources>
<Grid Background="White" Margin="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 标题栏 -->
<Border Grid.Row="0"
Background="#fafafa"
Height="50"
BorderThickness="0,0,0,1"
BorderBrush="#f0f0f0">
<Grid Margin="20,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
<ctls:FontAwesomeIcon
Icon="&#xf0f3;"
Foreground="#1890ff"
FontSize="18"
Margin="0,0,12,0"/>
<TextBlock Text="发现新版本"
FontSize="16"
FontWeight="Bold"
VerticalAlignment="Center"
Foreground="#333333"/>
</StackPanel>
<TextBlock Grid.Column="1"
Text="{Binding ApplicationName, StringFormat='{} {0}'}"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Foreground="#666666"
FontSize="12"/>
</Grid>
</Border>
<!-- 主要内容区域 -->
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" Padding="20">
<StackPanel>
<!-- 版本信息卡片 -->
<Border Background="#f8f9fa"
CornerRadius="6"
Padding="16"
Margin="0,0,0,16"
BorderThickness="1"
BorderBrush="#e9ecef">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- 版本图标 -->
<Border Grid.Column="0"
Background="#e6f7ff"
Width="40"
Height="40"
CornerRadius="20"
Margin="0,0,16,0">
<ctls:FontAwesomeIcon
Icon="&#xf019;"
Foreground="#1890ff"
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
<!-- 版本信息 -->
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<TextBlock Text="版本信息"
FontWeight="SemiBold"
FontSize="14"
Foreground="#333333"
Margin="0,0,0,8"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Margin="0,0,16,0">
<TextBlock Text="当前版本:" Foreground="#666666" Margin="0,0,0,6"/>
<TextBlock Text="最新版本:" Foreground="#666666" Margin="0,0,0,6"/>
<TextBlock Text="发布日期:" Foreground="#666666"/>
</StackPanel>
<StackPanel Grid.Column="1">
<TextBlock Text="{Binding CurrentVersion}"
FontWeight="SemiBold"
Margin="0,0,0,6"/>
<TextBlock Text="{Binding LatestVersion}"
FontWeight="SemiBold"
Foreground="#1890ff"
Margin="0,0,0,6"/>
<TextBlock Text="{Binding PublishDate}"
FontWeight="SemiBold"
Margin="0,0,0,6"/>
</StackPanel>
</Grid>
</StackPanel>
</Grid>
</Border>
<!-- 更新内容卡片 -->
<Border Background="White"
CornerRadius="6"
Padding="0"
Margin="0,0,0,16"
BorderThickness="1"
BorderBrush="#e9ecef">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- 卡片标题 -->
<Border Grid.Row="0"
Background="#f8f9fa"
CornerRadius="6,6,0,0"
Padding="16,12"
BorderThickness="0,0,0,1"
BorderBrush="#e9ecef">
<StackPanel Orientation="Horizontal">
<ctls:FontAwesomeIcon
Icon="&#xf0a1;"
Foreground="#faad14"
FontSize="14"
Margin="0,0,8,0"/>
<TextBlock Text="更新内容"
FontWeight="SemiBold"
FontSize="14"
Foreground="#333333"/>
</StackPanel>
</Border>
<!-- 更新内容 -->
<Border Grid.Row="1" Padding="16,12">
<ScrollViewer MaxHeight="150" VerticalScrollBarVisibility="Auto">
<TextBlock Text="{Binding Changelog}"
TextWrapping="Wrap"
Foreground="#666666"
LineHeight="20"
FontSize="13"/>
</ScrollViewer>
</Border>
</Grid>
</Border>
<!-- 强制更新提示(如果需要) -->
<Border x:Name="MandatoryUpdatePanel"
Background="#fff2f0"
CornerRadius="4"
Padding="12"
Margin="0,0,0,16"
BorderThickness="1"
BorderBrush="#ffccc7"
Visibility="Collapsed">
<StackPanel Orientation="Horizontal">
<ctls:FontAwesomeIcon
Icon="&#xf06a;"
Foreground="#ff4d4f"
FontSize="14"
Margin="0,0,8,0"/>
<TextBlock Text="此为强制更新,必须更新后才能继续使用应用程序。"
Foreground="#a8071a"
FontSize="12"
TextWrapping="Wrap"
FontWeight="SemiBold"/>
</StackPanel>
</Border>
<!-- 更新提示 -->
<Border Background="#fffbe6"
CornerRadius="4"
Padding="12"
Margin="0,0,0,16"
BorderThickness="1"
BorderBrush="#ffe58f">
<StackPanel Orientation="Horizontal">
<ctls:FontAwesomeIcon
Icon="&#xf05a;"
Foreground="#faad14"
FontSize="14"
Margin="0,0,8,0"/>
<TextBlock Text="更新过程中请不要关闭应用程序,更新完成后将自动重启。"
Foreground="#876800"
FontSize="12"
TextWrapping="Wrap"/>
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
<!-- 按钮区域 -->
<Border Grid.Row="2"
Background="#fafafa"
Height="70"
BorderThickness="0,1,0,0"
BorderBrush="#f0f0f0">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Margin="20,0">
<Button x:Name="LaterButton"
Content="稍后提醒"
Style="{StaticResource UpdateSecondaryButton}"
Click="LaterButton_Click"
Margin="0,0,12,0"/>
<Button Content="立即更新"
Style="{StaticResource UpdatePrimaryButton}"
Click="UpdateButton_Click"/>
</StackPanel>
</Border>
</Grid>
</hc:Window>