<UserControl x:Class="Plugin.DeviceDebug.Panels.PowerSupplyDebugPanel"
|
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:dp="clr-namespace:HMI.UI.DpUtil;assembly=HMI.UI"
|
mc:Ignorable="d"
|
d:DesignHeight="500" d:DesignWidth="600">
|
|
<Grid dp:GridHelper.Space="12" Margin="12">
|
<Grid.RowDefinitions>
|
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="*"/>
|
</Grid.RowDefinitions>
|
|
<!-- 标题 -->
|
<Border Grid.Row="0" Background="#2196F3" CornerRadius="4" Padding="12,8">
|
<TextBlock Text="电源控制面板" FontSize="16" FontWeight="Bold" Foreground="White"/>
|
</Border>
|
|
<!-- 设置区 -->
|
<Border Grid.Row="1" BorderBrush="#DDD" BorderThickness="1" CornerRadius="4" Padding="12">
|
<Grid dp:GridHelper.Space="10">
|
<Grid.RowDefinitions>
|
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
</Grid.RowDefinitions>
|
<Grid.ColumnDefinitions>
|
<ColumnDefinition Width="100"/>
|
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="50"/>
|
</Grid.ColumnDefinitions>
|
|
<!-- 电压设定 -->
|
<TextBlock Grid.Row="0" Grid.Column="0" Text="电压设定:" VerticalAlignment="Center" FontWeight="Bold"/>
|
<TextBox Grid.Row="0" Grid.Column="1" x:Name="voltageInput"
|
IsEnabled="{Binding IsMaintenanceMode, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
VerticalContentAlignment="Center" Padding="6,4" Text="0.00"/>
|
<TextBlock Grid.Row="0" Grid.Column="2" Text="V" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="#666"/>
|
|
<!-- 限流设定 -->
|
<TextBlock Grid.Row="1" Grid.Column="0" Text="限流设定:" VerticalAlignment="Center" FontWeight="Bold"/>
|
<TextBox Grid.Row="1" Grid.Column="1" x:Name="currentInput"
|
IsEnabled="{Binding IsMaintenanceMode, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
VerticalContentAlignment="Center" Padding="6,4" Text="0.000"/>
|
<TextBlock Grid.Row="1" Grid.Column="2" Text="A" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="#666"/>
|
|
<!-- 输出控制 -->
|
<TextBlock Grid.Row="2" Grid.Column="0" Text="输出控制:" VerticalAlignment="Center" FontWeight="Bold"/>
|
<ToggleButton Grid.Row="2" Grid.Column="1" x:Name="outputToggle"
|
IsEnabled="{Binding IsMaintenanceMode, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
Checked="OutputToggle_Changed" Unchecked="OutputToggle_Changed"
|
Height="30" Cursor="Hand">
|
<ToggleButton.Style>
|
<Style TargetType="ToggleButton">
|
<Setter Property="Content" Value="OFF"/>
|
<Setter Property="Background" Value="#F44336"/>
|
<Setter Property="Foreground" Value="White"/>
|
<Setter Property="FontWeight" Value="Bold"/>
|
<Style.Triggers>
|
<Trigger Property="IsChecked" Value="True">
|
<Setter Property="Content" Value="ON"/>
|
<Setter Property="Background" Value="#4CAF50"/>
|
</Trigger>
|
</Style.Triggers>
|
</Style>
|
</ToggleButton.Style>
|
</ToggleButton>
|
|
<!-- 操作按钮 -->
|
<StackPanel Grid.Row="3" Grid.ColumnSpan="3" Orientation="Horizontal"
|
dp:StackPanelHelper.ChildSpace="10" HorizontalAlignment="Left" Margin="0,6,0,0">
|
<Button x:Name="applyBtn" Content="设置" Padding="16,6"
|
IsEnabled="{Binding IsMaintenanceMode, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
Click="ApplyBtn_Click"
|
Background="#2196F3" Foreground="White" BorderThickness="0" Cursor="Hand"/>
|
<Button x:Name="measureBtn" Content="测量" Padding="16,6"
|
Click="MeasureBtn_Click"
|
Background="#4CAF50" Foreground="White" BorderThickness="0" Cursor="Hand"/>
|
</StackPanel>
|
</Grid>
|
</Border>
|
|
<!-- 实测值显示区 -->
|
<Border Grid.Row="2" BorderBrush="#DDD" BorderThickness="1" CornerRadius="4" Padding="12">
|
<Grid dp:GridHelper.Space="8">
|
<Grid.RowDefinitions>
|
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
</Grid.RowDefinitions>
|
<Grid.ColumnDefinitions>
|
<ColumnDefinition Width="100"/>
|
<ColumnDefinition Width="*"/>
|
</Grid.ColumnDefinitions>
|
|
<TextBlock Grid.Row="0" Grid.Column="0" Text="实测电压:" FontWeight="Bold" VerticalAlignment="Center"/>
|
<TextBlock Grid.Row="0" Grid.Column="1" x:Name="measuredVoltage"
|
Text="-- V" FontSize="18" Foreground="#2196F3" VerticalAlignment="Center"/>
|
|
<TextBlock Grid.Row="1" Grid.Column="0" Text="实测电流:" FontWeight="Bold" VerticalAlignment="Center"/>
|
<TextBlock Grid.Row="1" Grid.Column="1" x:Name="measuredCurrent"
|
Text="-- A" FontSize="18" Foreground="#FF9800" VerticalAlignment="Center"/>
|
|
<TextBlock Grid.Row="2" Grid.Column="0" Text="更新时间:" FontWeight="Bold" VerticalAlignment="Center"/>
|
<TextBlock Grid.Row="2" Grid.Column="1" x:Name="lastUpdateTime"
|
Text="--" Foreground="#999" VerticalAlignment="Center"/>
|
</Grid>
|
</Border>
|
|
|
</Grid>
|
</UserControl>
|