wenxiangchao
2026-11-02 fe2aa4880d5c9fd88088ad0ed81ebaca05629f5f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<Window x:Class="Plugin.IntegrationTest.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="仪器仪表注册 &amp; 硬件调试 - 集成测试环境" 
        Height="800" Width="1300"
        WindowStartupLocation="CenterScreen"
        WindowState="Maximized"
        Background="#F5F5F5"
        Loaded="Window_Loaded" Closing="Window_Closing">
    <Grid Margin="8">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
 
        <!-- 顶部状态栏 -->
        <Border Grid.Row="0" Background="#E3F2FD" CornerRadius="4" Padding="12,6" Margin="0,0,0,6">
            <DockPanel>
                <TextBlock Text="集成测试环境" FontSize="16" FontWeight="Bold" 
                           VerticalAlignment="Center" Foreground="#1565C0"/>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" DockPanel.Dock="Right">
                    <TextBlock x:Name="txtStatus" Text="就绪" FontSize="13" 
                               VerticalAlignment="Center" Foreground="#666" Margin="0,0,12,0"/>
                    <Button x:Name="btnRun" Content="▶ 运行自动化测试" Width="150" Height="32" 
                            FontSize="13" FontWeight="SemiBold"
                            Background="#4CAF50" Foreground="White" BorderThickness="0"
                            Cursor="Hand" Click="BtnRun_Click" Margin="0,0,6,0"/>
                    <Button x:Name="btnReset" Content="重置数据" Width="90" Height="32"
                            FontSize="13" Click="BtnReset_Click" Margin="0,0,6,0"
                            Background="#FF9800" Foreground="White" BorderThickness="0" Cursor="Hand"/>
                    <Button x:Name="btnClear" Content="清空日志" Width="80" Height="32" 
                            FontSize="13" Click="BtnClear_Click"/>
                </StackPanel>
            </DockPanel>
        </Border>
 
        <!-- 主 TabControl -->
        <TabControl x:Name="mainTabs" Grid.Row="1" Margin="0,4">
            <!-- Tab 1: 自动化测试 -->
            <TabItem Header="  自动化测试  " FontSize="13">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <ProgressBar x:Name="progressBar" Height="6" Minimum="0" Maximum="100" Value="0" Margin="4"/>
                    <TextBox x:Name="txtLog" Grid.Row="1"
                             IsReadOnly="True" VerticalScrollBarVisibility="Auto" 
                             HorizontalScrollBarVisibility="Auto"
                             FontFamily="Consolas" FontSize="12.5"
                             Background="#1E1E1E" Foreground="#D4D4D4"
                             BorderThickness="1" BorderBrush="#CCC"
                             Padding="8" TextWrapping="NoWrap"
                             AcceptsReturn="True" VerticalContentAlignment="Top"/>
                </Grid>
            </TabItem>
 
            <!-- Tab 2: 仪器仪表注册 -->
            <TabItem Header="  仪器仪表注册  " FontSize="13">
                <Border x:Name="deviceConfigHost" Background="White"/>
            </TabItem>
 
            <!-- Tab 3: 硬件调试 -->
            <TabItem Header="  硬件调试  " FontSize="13">
                <Border x:Name="deviceDebugHost" Background="White"/>
            </TabItem>
 
            <!-- Tab 4: CAN 模拟器 -->
            <TabItem Header="  CAN 模拟器  " FontSize="13">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    
                    <!-- 模拟器控制面板 -->
                    <Border Grid.Row="0" Background="#FFF3E0" CornerRadius="4" Padding="12,8" Margin="4">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            
                            <TextBlock Grid.Row="0" Grid.Column="0" Text="总线状态:" FontWeight="Bold" VerticalAlignment="Center" Margin="0,0,8,4"/>
                            <StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
                                <Ellipse x:Name="canBusIndicator" Width="14" Height="14" Fill="#9E9E9E" Margin="0,0,8,0"/>
                                <TextBlock x:Name="canBusStatusText" Text="未启动" FontSize="13"/>
                            </StackPanel>
                            
                            <TextBlock Grid.Row="1" Grid.Column="0" Text="总线名称:" FontWeight="Bold" VerticalAlignment="Center" Margin="0,0,8,4"/>
                            <TextBox Grid.Row="1" Grid.Column="1" x:Name="canBusNameInput" Text="CAN_BUS_1" 
                                     VerticalContentAlignment="Center" Padding="6,4" Margin="0,0,80,4" Width="200" HorizontalAlignment="Left"/>
                            
                            <TextBlock Grid.Row="2" Grid.Column="0" Text="控制:" FontWeight="Bold" VerticalAlignment="Center" Margin="0,0,8,0"/>
                            <StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal">
                                <Button x:Name="canStartBtn" Content="启动总线" Width="100" Height="30" Margin="0,0,8,0"
                                        Click="CanStartBtn_Click" Background="#4CAF50" Foreground="White" 
                                        BorderThickness="0" Cursor="Hand" FontWeight="SemiBold"/>
                                <Button x:Name="canStopBtn" Content="停止总线" Width="100" Height="30" Margin="0,0,8,0"
                                        Click="CanStopBtn_Click" Background="#F44336" Foreground="White" 
                                        BorderThickness="0" Cursor="Hand" FontWeight="SemiBold" IsEnabled="False"/>
                                <Button x:Name="canResetBtn" Content="重置所有" Width="100" Height="30"
                                        Click="CanResetBtn_Click" Background="#9E9E9E" Foreground="White" 
                                        BorderThickness="0" Cursor="Hand" FontWeight="SemiBold"/>
                            </StackPanel>
                        </Grid>
                    </Border>
                    
                    <!-- CAN 调试面板 -->
                    <Border x:Name="canSimulatorHost" Grid.Row="1" Background="White" Margin="4"/>
                </Grid>
            </TabItem>
        </TabControl>
 
        <!-- 底部结果栏 -->
        <Border Grid.Row="2" Padding="12,6" Background="#FAFAFA" 
                BorderBrush="#DDD" BorderThickness="1" CornerRadius="4">
            <DockPanel>
                <TextBlock x:Name="txtSummary" FontSize="13" FontWeight="SemiBold" 
                           VerticalAlignment="Center" Foreground="#333" Text="就绪 - 请切换到对应 Tab 进行手动测试"/>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" DockPanel.Dock="Right">
                    <TextBlock x:Name="txtPassed" FontSize="13" Foreground="#4CAF50" 
                               Margin="0,0,16,0" VerticalAlignment="Center"/>
                    <TextBlock x:Name="txtFailed" FontSize="13" Foreground="#F44336" 
                               VerticalAlignment="Center"/>
                </StackPanel>
            </DockPanel>
        </Border>
    </Grid>
</Window>