Files
FootwearTest/FootwearTest/Views/DashboardView.axaml
2026-05-26 15:17:18 +08:00

63 lines
4.1 KiB
XML

<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:FootwearTest.ViewModels"
xmlns:models="using:FootwearTest.Models"
x:Class="FootwearTest.Views.DashboardView"
x:DataType="vm:DashboardViewModel">
<ScrollViewer>
<StackPanel Margin="24" Spacing="18">
<Grid ColumnDefinitions="*,*,*,*">
<Border Background="White" BorderBrush="#DDE3EA" BorderThickness="1" CornerRadius="6" Padding="18" Margin="0,0,14,0">
<StackPanel>
<TextBlock Text="假脚温度" Foreground="#5B6775"/>
<TextBlock Text="{Binding Snapshot.FootTemperatureC, StringFormat='{}{0:F2} ℃'}" FontSize="28" FontWeight="SemiBold"/>
</StackPanel>
</Border>
<Border Grid.Column="1" Background="White" BorderBrush="#DDE3EA" BorderThickness="1" CornerRadius="6" Padding="18" Margin="0,0,14,0">
<StackPanel>
<TextBlock Text="环境温湿度" Foreground="#5B6775"/>
<TextBlock Text="{Binding Snapshot.EnvironmentTemperatureC, StringFormat='{}{0:F2} ℃'}" FontSize="28" FontWeight="SemiBold"/>
<TextBlock Text="{Binding Snapshot.EnvironmentHumidityPercent, StringFormat='{}{0:F1}% RH'}" Foreground="#5B6775"/>
</StackPanel>
</Border>
<Border Grid.Column="2" Background="White" BorderBrush="#DDE3EA" BorderThickness="1" CornerRadius="6" Padding="18" Margin="0,0,14,0">
<StackPanel>
<TextBlock Text="风速" Foreground="#5B6775"/>
<TextBlock Text="{Binding Snapshot.AirSpeedMetersPerSecond, StringFormat='{}{0:F2} m/s'}" FontSize="28" FontWeight="SemiBold"/>
</StackPanel>
</Border>
<Border Grid.Column="3" Background="White" BorderBrush="#DDE3EA" BorderThickness="1" CornerRadius="6" Padding="18">
<StackPanel>
<TextBlock Text="功率 / 出汗量" Foreground="#5B6775"/>
<TextBlock Text="{Binding Snapshot.PowerWatts, StringFormat='{}{0:F2} W'}" FontSize="28" FontWeight="SemiBold"/>
<TextBlock Text="{Binding Snapshot.WaterLossGramsPerHour, StringFormat='{}{0:F2} g/h'}" Foreground="#5B6775"/>
</StackPanel>
</Border>
</Grid>
<Border Background="White" BorderBrush="#DDE3EA" BorderThickness="1" CornerRadius="6" Padding="18">
<Grid RowDefinitions="Auto,*">
<Grid ColumnDefinitions="*,Auto">
<TextBlock Text="最近试验" FontSize="18" FontWeight="SemiBold"/>
<Button Grid.Column="1" Content="刷新" Command="{Binding RefreshCommand}"/>
</Grid>
<ItemsControl Grid.Row="1" ItemsSource="{Binding RecentRuns}" Margin="0,12,0,0">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="models:TestRunSummary">
<Border BorderBrush="#E4E9EF" BorderThickness="0,0,0,1" Padding="0,10">
<Grid ColumnDefinitions="140,190,*,90">
<TextBlock Text="{Binding CreatedAt, StringFormat='{}{0:MM-dd HH:mm}'}"/>
<TextBlock Grid.Column="1" Text="{Binding Method}"/>
<TextBlock Grid.Column="2" Text="{Binding ResultSummary}" TextWrapping="Wrap"/>
<TextBlock Grid.Column="3" Text="{Binding IsValid, StringFormat='有效: {0}'}"/>
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</Border>
</StackPanel>
</ScrollViewer>
</UserControl>