Files
BR_YKC/上位机/YKC/Pages/DashboardPage.xaml

93 lines
5.1 KiB
Plaintext
Raw Permalink Normal View History

2026-05-21 12:56:29 +08:00
<Page x:Class="YKC.DashboardPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="总览" Background="#F0F2F5">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Margin="24">
<!-- 统计卡片行 -->
<WrapPanel Margin="0,0,0,20">
<Border Background="White" CornerRadius="6" Width="240"
Padding="20,18" Margin="0,0,16,16">
<StackPanel>
<TextBlock Text="设备连接" Style="{StaticResource InfoLabel}"/>
<TextBlock x:Name="txtConnStatus" Text="--"
FontSize="20" FontWeight="SemiBold" Foreground="#1E293B"/>
</StackPanel>
</Border>
<Border Background="White" CornerRadius="6" Width="240"
Padding="20,18" Margin="0,0,16,16">
<StackPanel>
<TextBlock Text="在线充电桩" Style="{StaticResource InfoLabel}"/>
<TextBlock x:Name="txtOnlineCount" Text="--"
FontSize="28" FontWeight="SemiBold" Foreground="#10B981"/>
</StackPanel>
</Border>
<Border Background="White" CornerRadius="6" Width="240"
Padding="20,18" Margin="0,0,16,16">
<StackPanel>
<TextBlock Text="充电中" Style="{StaticResource InfoLabel}"/>
<TextBlock x:Name="txtChargingCount" Text="--"
FontSize="28" FontWeight="SemiBold" Foreground="#3B82F6"/>
</StackPanel>
</Border>
</WrapPanel>
<!-- 标题 + 按钮 -->
<Grid Margin="0,0,0,12">
<TextBlock Text="充电桩列表" FontSize="15" FontWeight="SemiBold"
Foreground="#1E293B" VerticalAlignment="Center"/>
<Button Content="刷新" Style="{StaticResource BtnPrimary}"
Width="90" HorizontalAlignment="Right"
Click="Refresh_Click"/>
</Grid>
<!-- 表格 -->
<Border Background="White" CornerRadius="6" Padding="0">
<DataGrid x:Name="dgPiles" AutoGenerateColumns="False" IsReadOnly="True"
HeadersVisibility="Column" CanUserAddRows="False"
CanUserDeleteRows="False" RowHeight="40"
GridLinesVisibility="Horizontal"
HorizontalGridLinesBrush="#F1F5F9"
BorderThickness="0" Background="White">
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="#F8FAFC"/>
<Setter Property="Foreground" Value="#64748B"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Padding" Value="16,10"/>
<Setter Property="BorderBrush" Value="#E2E8F0"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="Padding" Value="16,8"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridCell">
<Border Background="{TemplateBinding Background}">
<ContentPresenter Margin="{TemplateBinding Padding}"
VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="#" Width="50" Binding="{Binding Index}"/>
<DataGridTextColumn Header="序列号" Width="*" Binding="{Binding Serial}"/>
<DataGridTextColumn Header="桩状态" Width="80" Binding="{Binding StatusText}"/>
<DataGridTextColumn Header="枪1" Width="80" Binding="{Binding Gun1Text}"/>
<DataGridTextColumn Header="枪2" Width="80" Binding="{Binding Gun2Text}"/>
</DataGrid.Columns>
</DataGrid>
</Border>
</StackPanel>
</ScrollViewer>
</Page>