兼容win7版应用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

389 lines
23 KiB

<UserControl x:Class="AIK.Views.MenuPages.UpdateCenter.UpdateCenterPage"
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:AIK.Views.MenuPages.UpdateCenter"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:behaviors="clr-namespace:AIK.Behaviors;assembly=AIK.Behaviors"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<i:Interaction.Behaviors>
<behaviors:ViewModelInitializationBehavior/>
</i:Interaction.Behaviors>
<UserControl.Resources>
<!-- 淡蓝色主题颜色 -->
<Color x:Key="PrimaryBlue">#0078D7</Color>
<Color x:Key="LightBlue">#E3F2FD</Color>
<Color x:Key="SoftBlue">#BBDEFB</Color>
<Color x:Key="AccentBlue">#2196F3</Color>
<Color x:Key="BorderBlue">#90CAF9</Color>
<Color x:Key="TextDark">#1E3A5F</Color>
<Color x:Key="TextGray">#546E7A</Color>
<Color x:Key="BackgroundLight">#FAFBFC</Color>
<Color x:Key="HoverBlue">#E1F5FE</Color>
<Color x:Key="SelectedBlue">#F3F9FF</Color>
<Color x:Key="FocusBlue">#D4EDFF</Color>
<SolidColorBrush x:Key="PrimaryBlueBrush" Color="{StaticResource PrimaryBlue}"/>
<SolidColorBrush x:Key="LightBlueBrush" Color="{StaticResource LightBlue}"/>
<SolidColorBrush x:Key="SoftBlueBrush" Color="{StaticResource SoftBlue}"/>
<SolidColorBrush x:Key="AccentBlueBrush" Color="{StaticResource AccentBlue}"/>
<SolidColorBrush x:Key="BorderBlueBrush" Color="{StaticResource BorderBlue}"/>
<SolidColorBrush x:Key="TextDarkBrush" Color="{StaticResource TextDark}"/>
<SolidColorBrush x:Key="TextGrayBrush" Color="{StaticResource TextGray}"/>
<SolidColorBrush x:Key="BackgroundLightBrush" Color="{StaticResource BackgroundLight}"/>
<SolidColorBrush x:Key="HoverBlueBrush" Color="{StaticResource HoverBlue}"/>
<SolidColorBrush x:Key="SelectedBlueBrush" Color="{StaticResource SelectedBlue}"/>
<SolidColorBrush x:Key="FocusBlueBrush" Color="{StaticResource FocusBlue}"/>
<!-- 卡片样式 -->
<Style x:Key="ModernCardStyle" TargetType="Border">
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="{StaticResource BorderBlueBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Margin" Value="0,0,0,16"/>
</Style>
<!-- 标签样式 -->
<Style x:Key="ModernLabelStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource TextDarkBrush}"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="16,12,12,12"/>
<!--<Setter Property="Width" Value="100"/>-->
</Style>
<!-- 设置项容器样式 -->
<Style x:Key="ModernSettingItemStyle" TargetType="Grid">
<Setter Property="Margin" Value="0,12"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="PrimaryButtonStyle" TargetType="Button">
<Setter Property="Background" Value="#90CAF9"/>
<!-- 更淡的蓝 -->
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Padding" Value="24,12"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
CornerRadius="6"
Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#1E88E5"/>
<!-- 悬停用稍深一点的 Blue 600 -->
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#1976D2"/>
<!-- 按下回到你的标题色 -->
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="#B0BEC5"/>
</Trigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Grid Margin="10,10,20,10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--页面标题-->
<StackPanel Grid.Row="0" Margin="0,0,0,20">
<TextBlock Text="{DynamicResource UpdateCenterTitle}"
FontSize="16"
FontWeight="Bold"
Foreground="{StaticResource TextDarkBrush}"/>
<TextBlock Text="{DynamicResource UpdateCenterTips}"
FontSize="12"
Foreground="{StaticResource TextGrayBrush}"
Margin="0,4,0,0"/>
</StackPanel>
<!-- 设置内容区域 -->
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
<StackPanel>
<Border Style="{StaticResource ModernCardStyle}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- 卡片标题 -->
<Border Grid.Row="0"
Background="{StaticResource LightBlueBrush}"
CornerRadius="8,8,0,0"
Padding="16,12">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe62b;"
FontSize="18"
FontWeight="SemiBold"
Foreground="{StaticResource PrimaryBlueBrush}"
FontFamily="{StaticResource Iconfont}"/>
<TextBlock Text="{DynamicResource DeviceUpdate}"
FontSize="15"
FontWeight="SemiBold"
Margin="15,0,0,0"
Foreground="{StaticResource PrimaryBlueBrush}"/>
</StackPanel>
</Border>
<!-- 设置内容 -->
<Grid Grid.Row="1" Margin="10,0,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" FontSize="16" HorizontalAlignment="Center" Foreground="#99000000" Text="{DynamicResource DeviceName}"></TextBlock>
<TextBlock Grid.Row="0" Grid.Column="1" FontSize="16" HorizontalAlignment="Center" Foreground="#99000000" Text="{DynamicResource CurrentVersion}"></TextBlock>
<TextBlock Grid.Row="0" Grid.Column="2" FontSize="16" Foreground="#FF6B6B" HorizontalAlignment="Center"
Text="{DynamicResource NewVersion}"></TextBlock>
<TextBlock Grid.Row="0" Grid.Column="3" FontSize="16" HorizontalAlignment="Center" Foreground="#99000000" Text="{DynamicResource DeviceStatus}"></TextBlock>
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Vertical">
<Image Source="/AIK.Assets;component/Images/k3_tool.png" Width="30" Height="30" Cursor="" />
<TextBlock FontSize="16" HorizontalAlignment="Center">K3 TOOL</TextBlock>
</StackPanel>
<TextBlock Grid.Row="1" Grid.Column="1" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding CodeVersion}"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="2" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding K3UpdateInfo.VersionName}"></TextBlock>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="1" Grid.Column="3">
<TextBlock Text="{Binding HidDeviceStatus.DeviceStatusIcon}"
FontFamily="{StaticResource Iconfont}"
FontSize="20"
VerticalAlignment="Center"
Foreground="{Binding HidDeviceStatus.DeviceStatusColor}"
Margin="0,0,4,0"/>
<TextBlock Text="{Binding HidDeviceStatus.DeviceStatusText, TargetNullValue='未连接'}"
FontSize="14"
FontWeight="SemiBold"
VerticalAlignment="Center"/>
</StackPanel>
<WrapPanel Grid.Row="1" Grid.Column="4" >
<Button
Margin="0"
MinWidth="90" MinHeight="35"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Cursor="Hand"
BorderBrush="White"
Background="#FF2ECC71"
BorderThickness="1"
Visibility="{Binding IsK3ToolUpdateAvailable,Converter={StaticResource BoolToVisibilityConverter}}"
Command="{Binding UpdateK3ToolCommand}">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="12"
SnapsToDevicePixels="True"
>
<!-- 使用 TextBlock 显示图标字体,确保居中 -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
<TextBlock x:Name="iconText"
Text="&#xef4e;"
FontFamily="{StaticResource Iconfont}"
FontSize="14"
Foreground="White"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<TextBlock
Text="{DynamicResource UpgradeNow}"
FontSize="14"
Foreground="White"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#27AE60"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="#219653"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="border" Property="Background" Value="#FFCCCCCC"/>
<Setter TargetName="iconText" Property="Foreground" Value="#FF999999"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<Button
MinWidth="90" MinHeight="35"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Cursor="Hand"
BorderBrush="White"
Background="#FFCCCCCC"
BorderThickness="1"
Visibility="{Binding IsK3ToolUpdateAvailable,Converter={StaticResource BoolToVisibilityConverter}}"
Command="{Binding GetCurrentDeviceVersionCommand}">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="12"
SnapsToDevicePixels="True">
<!-- 使用 TextBlock 显示图标字体,确保居中 -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
<TextBlock
Text="{DynamicResource GetVersion}"
FontSize="14"
Foreground="White"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#BFBFBF"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="#BFBFBF"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="border" Property="Background" Value="#FFCCCCCC"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
</WrapPanel>
</Grid>
</Grid>
</Border>
<!--App更新-->
<Border Style="{StaticResource ModernCardStyle}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- 卡片标题 -->
<Border Grid.Row="0"
Background="{StaticResource LightBlueBrush}"
CornerRadius="8,8,0,0"
Padding="16,12">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe62b;"
FontSize="18"
FontWeight="SemiBold"
Foreground="{StaticResource PrimaryBlueBrush}"
FontFamily="{StaticResource Iconfont}"/>
<TextBlock Text="{DynamicResource AppVersion}"
FontSize="15"
FontWeight="SemiBold"
Margin="15,0,0,0"
Foreground="{StaticResource PrimaryBlueBrush}"/>
</StackPanel>
</Border>
<!-- 设置内容 -->
<Grid Grid.Row="1" Margin="10,0,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" FontSize="16" HorizontalAlignment="Center" Foreground="#99000000" Text="{DynamicResource CurrentVersion}"></TextBlock>
<TextBlock Grid.Row="0" Grid.Column="1" FontSize="16" HorizontalAlignment="Center" Foreground="#99000000" Text="{DynamicResource ServerVersion}"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="0" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding AppUpdateInfo.CurrentVersion}"></TextBlock>
<TextBlock Grid.Row="1" Grid.Column="1" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding AppUpdateInfo.LatestVersion}"></TextBlock>
<Button Grid.Row="1" Grid.Column="2"
Margin="0"
MinWidth="90" MinHeight="35"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Cursor="Hand"
BorderBrush="White"
Background="#FF2ECC71"
BorderThickness="1"
Command="{Binding UpdateAppCommand}">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="12"
SnapsToDevicePixels="True"
>
<!-- 使用 TextBlock 显示图标字体,确保居中 -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" >
<TextBlock x:Name="iconText"
Text="&#xef4e;"
FontFamily="{StaticResource Iconfont}"
FontSize="14"
Foreground="White"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<TextBlock
Text="{DynamicResource UpgradeNow}"
FontSize="14"
Foreground="White"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#27AE60"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="#219653"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="border" Property="Background" Value="#FFCCCCCC"/>
<Setter TargetName="iconText" Property="Foreground" Value="#FF999999"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<!--<TextBlock>@</TextBlock>-->
</Grid>
</Grid>
</Border>
</StackPanel>
</ScrollViewer>
</Grid>
</UserControl>