将Feature/XP.Common和Feature/XP.Hardware分支合并至Develop/XP.forHardwareAndCommon,完善XPapp注册和相关硬件类库通用类库功能。
This commit is contained in:
@@ -0,0 +1,279 @@
|
||||
<UserControl
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:XP.Hardware.RaySource.Converters"
|
||||
xmlns:enums="clr-namespace:XP.Hardware.RaySource.Abstractions.Enums"
|
||||
xmlns:loc="clr-namespace:XP.Common.Localization.Extensions;assembly=XP.Common"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="XP.Hardware.RaySource.Views.RaySourceOperateView"
|
||||
mc:Ignorable="d" d:DesignWidth="350"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True" Height="249" Background="White" >
|
||||
<UserControl.Resources>
|
||||
<!-- 转换器 | Converters -->
|
||||
<converters:RaySourceStatusToColorConverter x:Key="StatusToColorConverter"/>
|
||||
<converters:RaySourceStatusToBorderColorConverter x:Key="StatusToBorderColorConverter"/>
|
||||
|
||||
<!-- 呼吸闪烁动画 | Breathing Flash Animation -->
|
||||
<Storyboard x:Key="BreathingAnimation" RepeatBehavior="Forever">
|
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity"
|
||||
From="1.0" To="0.6" Duration="0:0:0.75"
|
||||
AutoReverse="True"/>
|
||||
</Storyboard>
|
||||
|
||||
<!-- 按钮样式 | Button Style -->
|
||||
<Style x:Key="RaySourceButtonStyle" TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="#E0E0E0"/>
|
||||
<Setter Property="BorderBrush" Value="#BDBDBD"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Foreground" Value="Black"/>
|
||||
<Setter Property="FontSize" Value="12"/>
|
||||
<Setter Property="FontWeight" Value="Medium"/>
|
||||
<Setter Property="Padding" Value="8"/>
|
||||
<Setter Property="Width" Value="85"/>
|
||||
<Setter Property="Height" Value="30"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border CornerRadius="4" Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="#BDBDBD"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="#9E9E9E"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Background" Value="#F5F5F5"/>
|
||||
<Setter Property="Foreground" Value="#BDBDBD"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" MinHeight="70" />
|
||||
<RowDefinition Height="Auto" MinHeight="70" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 1. 状态区:腰圆指示器 + 按钮 | Status Area: Capsule Indicator + Buttons -->
|
||||
<Grid Grid.Row="0" Margin="5,5,5,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 腰圆状态指示器 | Capsule Status Indicator -->
|
||||
<Grid Grid.Column="0" Width="200" Height="80" Margin="20 0 0 5">
|
||||
<Border x:Name="StatusIndicator"
|
||||
Width="200" Height="80"
|
||||
Background="{Binding RaySourceStatus, Converter={StaticResource StatusToColorConverter}}"
|
||||
BorderBrush="{Binding RaySourceStatus, Converter={StaticResource StatusToBorderColorConverter}}"
|
||||
BorderThickness="2"
|
||||
CornerRadius="40">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding RaySourceStatus}"
|
||||
Value="{x:Static enums:RaySourceStatus.Opened}">
|
||||
<DataTrigger.EnterActions>
|
||||
<BeginStoryboard Name="BreathingStoryboard" Storyboard="{StaticResource BreathingAnimation}"/>
|
||||
</DataTrigger.EnterActions>
|
||||
<DataTrigger.ExitActions>
|
||||
<StopStoryboard BeginStoryboardName="BreathingStoryboard"/>
|
||||
</DataTrigger.ExitActions>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
</Border>
|
||||
<TextBlock Text="{Binding StatusText}"
|
||||
Foreground="White" FontSize="18" FontWeight="Bold"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
TextAlignment="Center" LineHeight="20"/>
|
||||
<!-- 连锁状态图标(腰圆右侧圆弧区域)| Interlock status icon (right arc area of capsule) -->
|
||||
<Image Width="22" Height="22"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Center"
|
||||
Margin="0,0,20,0"
|
||||
RenderOptions.BitmapScalingMode="HighQuality">
|
||||
<Image.Style>
|
||||
<Style TargetType="Image">
|
||||
<!-- 默认未激活:解锁图标 | Default inactive: unlocked icon -->
|
||||
<Setter Property="Source" Value="/XP.Hardware.RaySource;component/Resources/Unlocked.png"/>
|
||||
<Setter Property="ToolTip" Value="{loc:Localization RaySource_InterlockNormal}"/>
|
||||
<Style.Triggers>
|
||||
<!-- 激活时:锁定图标 | Active: locked icon -->
|
||||
<DataTrigger Binding="{Binding IsInterlockActive}" Value="True">
|
||||
<Setter Property="Source" Value="/XP.Hardware.RaySource;component/Resources/Locked.png"/>
|
||||
<Setter Property="ToolTip" Value="{loc:Localization RaySource_InterlockActive}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Image.Style>
|
||||
</Image>
|
||||
</Grid>
|
||||
|
||||
<!-- 按钮区 | Button Area -->
|
||||
<StackPanel Grid.Column="1" Orientation="Vertical"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
||||
Margin="20 0 20 0">
|
||||
<telerik:RadButton Content="{loc:Localization RaySource_TurnOnButton}"
|
||||
Command="{Binding TurnOnCommand}"
|
||||
Margin="0 0 0 8" Height="35" HorizontalAlignment="Stretch"
|
||||
telerik:StyleManager.Theme="Crystal">
|
||||
<telerik:RadButton.Background>
|
||||
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="White"/>
|
||||
<GradientStop Color="#FF77E062" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</telerik:RadButton.Background>
|
||||
</telerik:RadButton>
|
||||
<telerik:RadButton Content="{loc:Localization RaySource_TurnOffButton}"
|
||||
Command="{Binding TurnOffCommand}"
|
||||
Margin="0 0 0 0" Height="35" HorizontalAlignment="Stretch"
|
||||
telerik:StyleManager.Theme="Crystal">
|
||||
<telerik:RadButton.Background>
|
||||
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
|
||||
<GradientStop Color="White"/>
|
||||
<GradientStop Color="#FFFFA1A1" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</telerik:RadButton.Background>
|
||||
</telerik:RadButton>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- 2. 电压区 | Voltage Area -->
|
||||
<Grid Grid.Row="1" Margin="20,0,20,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 标签+实际值 | Label + Actual Value -->
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{loc:Localization RaySource_VoltageLabel}"
|
||||
FontSize="14" FontWeight="Bold" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding VoltageActualText}"
|
||||
FontSize="10" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<telerik:RadSlider x:Name="VoltageSlider" Grid.Column="0" HorizontalAlignment="Stretch" Margin="0,5,10,0" VerticalAlignment="Center"
|
||||
telerik:StyleManager.Theme="Crystal"
|
||||
Minimum="{Binding VoltageMin}"
|
||||
Maximum="{Binding VoltageMax}"
|
||||
Value="{Binding VoltageValue, Mode=TwoWay}"
|
||||
SmallChange="1" LargeChange="10"
|
||||
IsDeferredDraggingEnabled="True"
|
||||
IsEnabled="{Binding IsSlidersEnabled}"/>
|
||||
<telerik:RadNumericUpDown x:Name="VoltageNumeric" Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,0,0" VerticalAlignment="Center" Width="70"
|
||||
Minimum="{Binding VoltageMin}"
|
||||
Maximum="{Binding VoltageMax}"
|
||||
Value="{Binding VoltageValue, Mode=TwoWay}"
|
||||
SmallChange="1" LargeChange="10"
|
||||
IsEnabled="{Binding IsSlidersEnabled}"
|
||||
NumberDecimalDigits="0" telerik:StyleManager.Theme="Crystal" FontSize="11"/>
|
||||
<!-- 最小值 | Minimum Value -->
|
||||
<TextBlock Grid.Column="0" Text="{Binding VoltageMin, StringFormat={}{0:F0}}"
|
||||
FontSize="12" Foreground="#616161"
|
||||
HorizontalAlignment="Left" VerticalAlignment="Bottom"
|
||||
Margin="0 0 0 -17"/>
|
||||
<!-- 最大值 | Maximum Value -->
|
||||
<TextBlock Grid.Column="0" Text="{Binding VoltageMax, StringFormat={}{0:F0}}"
|
||||
FontSize="12" Foreground="#616161"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Bottom" TextAlignment="Right"
|
||||
Margin="0,0,10,-17"/>
|
||||
</Grid>
|
||||
<!-- 按钮行:配置 | Button Row: Config -->
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,5,0,0">
|
||||
<telerik:RadButton Content="{loc:Localization RaySource_ConfigButton}"
|
||||
Command="{Binding ConfigCommand}"
|
||||
Width="70"
|
||||
telerik:StyleManager.Theme="Crystal" FontSize="10"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- 3. 电流区 | Current Area -->
|
||||
<Grid Grid.Row="1" Margin="20,75,20,0" Grid.RowSpan="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- 标签+实际值 | Label + Actual Value -->
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="{loc:Localization RaySource_CurrentLabel}"
|
||||
FontSize="14" FontWeight="Bold" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding CurrentActualText}"
|
||||
FontSize="10" VerticalAlignment="Center" HorizontalAlignment="Right"/>
|
||||
</Grid>
|
||||
|
||||
<!-- 滑块 | Slider -->
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<telerik:RadSlider x:Name="CurrentSlider" Grid.Column="0" HorizontalAlignment="Stretch" Margin="0,6,10,0" VerticalAlignment="Top"
|
||||
telerik:StyleManager.Theme="Crystal"
|
||||
Minimum="{Binding CurrentMin}"
|
||||
Maximum="{Binding CurrentMax}"
|
||||
Value="{Binding CurrentValue, Mode=TwoWay}"
|
||||
SmallChange="10" LargeChange="100"
|
||||
IsDeferredDraggingEnabled="True"
|
||||
IsEnabled="{Binding IsSlidersEnabled}"/>
|
||||
<telerik:RadNumericUpDown x:Name="CurrentNumeric" Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,0,0" VerticalAlignment="Center" Width="70"
|
||||
Minimum="{Binding CurrentMin}"
|
||||
Maximum="{Binding CurrentMax}"
|
||||
Value="{Binding CurrentValue, Mode=TwoWay}"
|
||||
SmallChange="10" LargeChange="100"
|
||||
IsEnabled="{Binding IsSlidersEnabled}"
|
||||
NumberDecimalDigits="0" telerik:StyleManager.Theme="Crystal" FontSize="11"/>
|
||||
<!-- 最小值 | Minimum Value -->
|
||||
<TextBlock Grid.Column="0" Text="{Binding CurrentMin, StringFormat={}{0:F0}}"
|
||||
FontSize="12" Foreground="#616161"
|
||||
HorizontalAlignment="Left" VerticalAlignment="Bottom"
|
||||
Margin="0 0 0 -17"/>
|
||||
<!-- 最大值 | Maximum Value -->
|
||||
<TextBlock Grid.Column="0" Text="{Binding CurrentMax, StringFormat={}{0:F0}}"
|
||||
FontSize="12" Foreground="#616161"
|
||||
HorizontalAlignment="Right" VerticalAlignment="Bottom" TextAlignment="Right"
|
||||
Margin="0,0,10,-17"/>
|
||||
</Grid>
|
||||
|
||||
<!-- 按钮行:高级 | Button Row: Advance -->
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,5,0,0">
|
||||
<telerik:RadButton Content="{loc:Localization RaySource_AdvanceButton}"
|
||||
Command="{Binding SettingsCommand}"
|
||||
Width="70"
|
||||
telerik:StyleManager.Theme="Crystal" FontSize="10"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
Reference in New Issue
Block a user