-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
1232 lines (1146 loc) · 80.9 KB
/
Copy pathMainWindow.xaml
File metadata and controls
1232 lines (1146 loc) · 80.9 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<Window x:Class="dji_cloud_tool.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:dji_cloud_tool"
mc:Ignorable="d"
Title="DJI Dock Cloud Debugging Tool (大疆机场/无人机调试工具) - Antigravity"
Height="780" Width="1280"
MinHeight="700" MinWidth="1100"
Background="#0F172A"
Foreground="#F8FAFC"
WindowStartupLocation="CenterScreen">
<Window.Resources>
<!-- Dark Slate Styling -->
<Color x:Key="BgDarkColor">#0F172A</Color>
<Color x:Key="BgCardColor">#1E293B</Color>
<Color x:Key="BorderColor">#334155</Color>
<Color x:Key="AccentColor">#38BDF8</Color>
<Color x:Key="TextMainColor">#F8FAFC</Color>
<Color x:Key="TextSecColor">#94A3B8</Color>
<SolidColorBrush x:Key="BgDark" Color="{StaticResource BgDarkColor}"/>
<SolidColorBrush x:Key="BgCard" Color="{StaticResource BgCardColor}"/>
<SolidColorBrush x:Key="BorderBrush" Color="{StaticResource BorderColor}"/>
<SolidColorBrush x:Key="AccentBrush" Color="{StaticResource AccentColor}"/>
<SolidColorBrush x:Key="TextMain" Color="{StaticResource TextMainColor}"/>
<SolidColorBrush x:Key="TextSec" Color="{StaticResource TextSecColor}"/>
<!-- Custom Buttons -->
<Style TargetType="Button">
<Setter Property="Background" Value="#0284C7"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="10,6"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
CornerRadius="4"
Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#38BDF8"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="#475569"/>
<Setter Property="Foreground" Value="#94A3B8"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="DangerButton" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Background" Value="#EF4444"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
CornerRadius="4"
Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#F87171"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SecButton" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Background" Value="#334155"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
CornerRadius="4"
Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#475569"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Custom TreeViewItem selection styling to eliminate white box -->
<Style TargetType="TreeViewItem">
<Setter Property="Padding" Value="6,6"/>
<Setter Property="Margin" Value="0,3"/>
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#0284C7"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#1E293B"/>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="White"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="White"/>
</Style.Resources>
</Style>
<!-- Dark Theme ComboBox ToggleButton Template -->
<ControlTemplate x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="22" />
</Grid.ColumnDefinitions>
<Border x:Name="Border"
Grid.ColumnSpan="2"
CornerRadius="4"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" />
<Path x:Name="Arrow"
Grid.Column="1"
Fill="#94A3B8"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 0 0 L 4 4 L 8 0 Z" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Border" Property="Background" Value="#334155" />
<Setter TargetName="Arrow" Property="Fill" Value="White" />
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Border" Property="Background" Value="#334155" />
<Setter TargetName="Arrow" Property="Fill" Value="#38BDF8" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<!-- Custom Dark ComboBox Style -->
<Style TargetType="{x:Type ComboBox}">
<Setter Property="Background" Value="#1E293B"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderBrush" Value="#334155"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="8,5"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBox}">
<Grid>
<ToggleButton Name="ToggleButton"
Template="{StaticResource ComboBoxToggleButton}"
Grid.Column="0"
Focusable="False"
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
ClickMode="Press"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"/>
<ContentPresenter Name="ContentSite"
IsHitTestVisible="False"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
Margin="{TemplateBinding Padding}"
VerticalAlignment="Center"
HorizontalAlignment="Left" />
<TextBox x:Name="PART_EditableTextBox"
Style="{x:Null}"
Template="{x:Null}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="{TemplateBinding Padding}"
Focusable="True"
Background="Transparent"
Foreground="White"
CaretBrush="White"
Visibility="Hidden"
IsReadOnly="{TemplateBinding IsReadOnly}"/>
<Popup Name="Popup"
Placement="Bottom"
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide">
<Grid Name="DropDown"
SnapsToDevicePixels="True"
MinWidth="{TemplateBinding ActualWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}">
<Border x:Name="DropDownBorder"
Background="#0F172A"
BorderBrush="#334155"
BorderThickness="1"
CornerRadius="4"
Margin="0,2,0,0">
<ScrollViewer Margin="4" SnapsToDevicePixels="True">
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</Border>
</Grid>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="HasItems" Value="False">
<Setter TargetName="DropDownBorder" Property="MinHeight" Value="60"/>
</Trigger>
<Trigger Property="IsGrouping" Value="True">
<Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
</Trigger>
<Trigger Property="IsEditable" Value="True">
<Setter Property="IsTabStop" Value="False"/>
<Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible"/>
<Setter TargetName="ContentSite" Property="Visibility" Value="Hidden"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Custom Dark ComboBoxItem Style -->
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="Background" Value="#0F172A"/>
<Setter Property="Foreground" Value="#F8FAFC"/>
<Setter Property="Padding" Value="8,6"/>
<Setter Property="Margin" Value="0,1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
<Border x:Name="ItemBorder"
Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}"
CornerRadius="3">
<ContentPresenter VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ItemBorder" Property="Background" Value="#334155"/>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="ItemBorder" Property="Background" Value="#0284C7"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Custom TextBox -->
<Style TargetType="TextBox">
<Setter Property="Background" Value="#0F172A"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderBrush" Value="#334155"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="6,4"/>
<Setter Property="CaretBrush" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4">
<ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter TargetName="border" Property="BorderBrush" Value="#38BDF8"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- TabControl Styling -->
<Style TargetType="TabControl">
<Setter Property="Background" Value="#0F172A"/>
<Setter Property="BorderBrush" Value="#334155"/>
<Setter Property="BorderThickness" Value="0,1,0,0"/>
</Style>
<Style TargetType="TabItem">
<Setter Property="Header" Value="{Binding Header}"/>
<Setter Property="Foreground" Value="#94A3B8"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0,0,0,2"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Padding" Value="16,8"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}">
<ContentPresenter ContentSource="Header" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="#38BDF8"/>
<Setter Property="BorderBrush" Value="#38BDF8"/>
<Setter Property="Background" Value="#1E293B"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#1E293B"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Custom Card Border -->
<Style x:Key="CardBorder" TargetType="Border">
<Setter Property="Background" Value="#1E293B"/>
<Setter Property="BorderBrush" Value="#334155"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="Padding" Value="12"/>
<Setter Property="Margin" Value="0,0,0,10"/>
</Style>
<!-- Visual Telemetry Card -->
<Style x:Key="TelemetryCard" TargetType="Border">
<Setter Property="Background" Value="#1E293B"/>
<Setter Property="BorderBrush" Value="#334155"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="6"/>
<Setter Property="Padding" Value="12"/>
<Setter Property="Margin" Value="4"/>
</Style>
<!-- Title of Visual Card -->
<Style x:Key="CardTitle" TargetType="TextBlock">
<Setter Property="Foreground" Value="#94A3B8"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Margin" Value="0,0,0,4"/>
</Style>
<!-- Value of Visual Card -->
<Style x:Key="CardValue" TargetType="TextBlock">
<Setter Property="Foreground" Value="#F8FAFC"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="FontWeight" Value="Bold"/>
</Style>
</Window.Resources>
<Grid Margin="10">
<Grid.ColumnDefinitions>
<!-- Left Sidebar -->
<ColumnDefinition Width="380"/>
<!-- Grid Splitter -->
<ColumnDefinition Width="8"/>
<!-- Main Content Area -->
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- LEFT SIDEBAR -->
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<!-- MQTT Connections -->
<RowDefinition Height="Auto"/>
<!-- Device Management -->
<RowDefinition Height="2*"/>
<!-- Subscriptions -->
<RowDefinition Height="3*"/>
</Grid.RowDefinitions>
<!-- MQTT CONFIGURATION CARD -->
<Border Grid.Row="0" Style="{StaticResource CardBorder}">
<StackPanel>
<Grid Margin="0,0,0,8">
<TextBlock Text="MQTT 连接管理" Foreground="White" FontSize="14" FontWeight="Bold" VerticalAlignment="Center"/>
<Ellipse x:Name="MqttStatusIndicator" Width="10" Height="10" Fill="#64748B" HorizontalAlignment="Right" VerticalAlignment="Center" ToolTip="已断开"/>
</Grid>
<Grid Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="60"/>
</Grid.ColumnDefinitions>
<TextBox x:Name="TxtBroker" Text="broker.emqx.io" Margin="0,0,4,0" ToolTip="Broker 地址"/>
<TextBox x:Name="TxtPort" Grid.Column="1" Text="1883" ToolTip="端口"/>
</Grid>
<Grid Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBox x:Name="TxtUsername" Text="" Margin="0,0,4,0" ToolTip="用户名 (可留空)"/>
<PasswordBox x:Name="TxtPassword" Grid.Column="1" ToolTip="密码 (可留空)" Background="#0F172A" Foreground="White" BorderBrush="#334155" BorderThickness="1" Padding="6,4"/>
</Grid>
<Grid Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox x:Name="TxtClientId" Text="dji_debug_tool_antigravity" ToolTip="Client ID" VerticalAlignment="Center"/>
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" Margin="8,0,0,0">
<CheckBox x:Name="ChkUseTls" Content="TLS" Foreground="White" Margin="0,0,8,0" IsChecked="False"/>
<CheckBox x:Name="ChkIgnoreCert" Content="跳过证书" Foreground="White" IsChecked="True"/>
</StackPanel>
</Grid>
<Button x:Name="BtnMqttConnect" Content="连 接 Broker" Height="32" Click="BtnMqttConnect_Click" Margin="0,4,0,0"/>
</StackPanel>
</Border>
<!-- DEVICE LIST CARD -->
<Border Grid.Row="1" Style="{StaticResource CardBorder}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="设备列表 (树形结构)" Foreground="White" FontSize="14" FontWeight="Bold" Margin="0,0,0,6"/>
<TreeView x:Name="TreeDevices" Grid.Row="1" Background="Transparent" BorderThickness="0" Foreground="White" SelectedItemChanged="TreeDevices_SelectedItemChanged">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate DataType="{x:Type local:DeviceItem}" ItemsSource="{Binding SubDevices}">
<StackPanel Orientation="Horizontal" Margin="4,6">
<Ellipse Width="8" Height="8" Margin="0,0,6,0" VerticalAlignment="Center">
<Ellipse.Style>
<Style TargetType="Ellipse">
<Setter Property="Fill" Value="#EF4444"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsOnline}" Value="True">
<Setter Property="Fill" Value="#10B981"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
</Ellipse>
<TextBlock Text="{Binding Name}" FontWeight="Bold"/>
<TextBlock Text=" (" Foreground="#94A3B8"/>
<TextBlock Text="{Binding Sn}" Foreground="#38BDF8"/>
<TextBlock Text=")" Foreground="#94A3B8"/>
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<!-- Add/Remove Device Form -->
<StackPanel Grid.Row="2" Margin="0,6,0,0">
<Grid Margin="0,0,0,4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ComboBox x:Name="ComboDeviceType" SelectedIndex="0">
<ComboBoxItem Content="机场"/>
<ComboBoxItem Content="无人机"/>
</ComboBox>
<TextBox x:Name="TxtAddDeviceSn" Grid.Column="1" Margin="4,0" ToolTip="设备 SN"/>
<TextBox x:Name="TxtAddDeviceName" Grid.Column="2" Width="80" ToolTip="备注名"/>
</Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button x:Name="BtnAddDevice" Content="添加设备" Click="BtnAddDevice_Click" Margin="0,0,4,0"/>
<Button x:Name="BtnDeleteDevice" Grid.Column="1" Content="删除设备" Style="{StaticResource DangerButton}" Click="BtnDeleteDevice_Click" Margin="4,0,0,0"/>
</Grid>
</StackPanel>
</Grid>
</Border>
<!-- TOPIC SUBSCRIPTION MANAGEMENT -->
<Border Grid.Row="2" Style="{StaticResource CardBorder}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="Topic 订阅管理" Foreground="White" FontSize="14" FontWeight="Bold" Margin="0,0,0,6"/>
<ListView x:Name="ListTopics" Grid.Row="1" Background="Transparent" BorderThickness="0" Foreground="White" SelectionChanged="ListTopics_SelectionChanged">
<ListView.ItemTemplate>
<DataTemplate DataType="{x:Type local:MqttTopicItem}">
<Grid Margin="0,2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<CheckBox IsChecked="{Binding IsEnabled}" Checked="TopicCheckbox_Changed" Unchecked="TopicCheckbox_Changed" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="{Binding Topic}" Margin="8,0,0,0" Foreground="White" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" ToolTip="{Binding Topic}"/>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<StackPanel Grid.Row="2" Margin="0,6,0,0">
<Grid Margin="0,0,0,4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBox x:Name="TxtAddTopic" Margin="0,0,4,0" ToolTip="自定义 Topic"/>
<Button x:Name="BtnAddTopic" Grid.Column="1" Content="添加 Topic" Click="BtnAddTopic_Click"/>
</Grid>
<Button x:Name="BtnDeleteTopic" Content="删除选中的自定义 Topic" Style="{StaticResource DangerButton}" Click="BtnDeleteTopic_Click"/>
</StackPanel>
</Grid>
</Border>
</Grid>
<!-- SPLITTER -->
<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" Background="Transparent" ResizeBehavior="PreviousAndNext"/>
<!-- MAIN PANEL -->
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<!-- Active Device Header -->
<RowDefinition Height="Auto"/>
<!-- Tabs -->
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Active Device Header -->
<Border Grid.Row="0" Style="{StaticResource CardBorder}" Margin="0,0,0,8" Padding="12,6">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="当前选定设备:" Foreground="#94A3B8" FontSize="14" VerticalAlignment="Center"/>
<TextBlock x:Name="TxtSelectedDeviceName" Text="[无]" Foreground="#38BDF8" FontSize="14" FontWeight="Bold" Margin="4,0,16,0" VerticalAlignment="Center"/>
<TextBlock Text="SN:" Foreground="#94A3B8" FontSize="14" VerticalAlignment="Center"/>
<TextBlock x:Name="TxtSelectedDeviceSn" Text="-" Foreground="#E2E8F0" FontSize="14" Margin="4,0,16,0" VerticalAlignment="Center"/>
<TextBlock Text="类型:" Foreground="#94A3B8" FontSize="14" VerticalAlignment="Center"/>
<TextBlock x:Name="TxtSelectedDeviceType" Text="-" Foreground="#E2E8F0" FontSize="14" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="刷新间隔:" Foreground="#94A3B8" VerticalAlignment="Center" Margin="0,0,8,0"/>
<Slider x:Name="SliderRefreshRate" Minimum="100" Maximum="2000" Value="500" Width="120" TickFrequency="100" IsSnapToTickEnabled="True" VerticalAlignment="Center" ValueChanged="SliderRefreshRate_ValueChanged"/>
<TextBlock x:Name="TxtRefreshInterval" Text="500 ms" Foreground="White" Width="60" Margin="8,0,0,0" VerticalAlignment="Center" TextAlignment="Right"/>
</StackPanel>
</Grid>
</Border>
<!-- Tab Pages -->
<TabControl Grid.Row="1">
<!-- TAB 1: OSD telemetry DASHBOARD -->
<TabItem Header="OSD 遥测看板">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Padding="0,10,0,0">
<Grid>
<!-- Dock OSD Layout -->
<Grid x:Name="GridDockTelemetry" Visibility="Visible">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Row 0 -->
<Border Grid.Row="0" Grid.Column="0" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="舱盖状态" Style="{StaticResource CardTitle}"/>
<TextBlock Text="{Binding CoverState}" Style="{StaticResource CardValue}"/>
</StackPanel>
</Border>
<Border Grid.Row="0" Grid.Column="1" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="空调状态" Style="{StaticResource CardTitle}"/>
<TextBlock Text="{Binding AirConditionerState}" Style="{StaticResource CardValue}"/>
</StackPanel>
</Border>
<Border Grid.Row="0" Grid.Column="2" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="飞行器是否在舱" Style="{StaticResource CardTitle}"/>
<TextBlock Text="{Binding DroneInDock}" Style="{StaticResource CardValue}"/>
</StackPanel>
</Border>
<Border Grid.Row="0" Grid.Column="3" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="充电状态 & 飞行器电量" Style="{StaticResource CardTitle}"/>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding ChargingState}" Style="{StaticResource CardValue}"/>
<TextBlock Text=" (" Foreground="#94A3B8" Style="{StaticResource CardValue}"/>
<TextBlock Text="{Binding DroneBatteryPercent}" Foreground="#10B981" Style="{StaticResource CardValue}"/>
<TextBlock Text=")" Foreground="#94A3B8" Style="{StaticResource CardValue}"/>
</StackPanel>
</StackPanel>
</Border>
<!-- Row 1 -->
<Border Grid.Row="1" Grid.Column="0" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="环境温度" Style="{StaticResource CardTitle}"/>
<TextBlock Text="{Binding EnvironmentTemp}" Style="{StaticResource CardValue}"/>
</StackPanel>
</Border>
<Border Grid.Row="1" Grid.Column="1" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="舱内温湿度" Style="{StaticResource CardTitle}"/>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding CabinTemp}" Style="{StaticResource CardValue}"/>
<TextBlock Text=" / " Foreground="#94A3B8" Style="{StaticResource CardValue}"/>
<TextBlock Text="{Binding Humidity}" Style="{StaticResource CardValue}"/>
</StackPanel>
</StackPanel>
</Border>
<Border Grid.Row="1" Grid.Column="2" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="风速估计" Style="{StaticResource CardTitle}"/>
<TextBlock Text="{Binding WindSpeed}" Style="{StaticResource CardValue}"/>
</StackPanel>
</Border>
<Border Grid.Row="1" Grid.Column="3" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="降雨等级" Style="{StaticResource CardTitle}"/>
<TextBlock Text="{Binding Rainfall}" Style="{StaticResource CardValue}"/>
</StackPanel>
</Border>
<!-- Row 2 -->
<Border Grid.Row="2" Grid.Column="0" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="搜星状态 / RTK" Style="{StaticResource CardTitle}"/>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding GpsCount}" Style="{StaticResource CardValue}"/>
<TextBlock Text=" | " Foreground="#94A3B8" Style="{StaticResource CardValue}"/>
<TextBlock Text="{Binding RtkStatus}" Foreground="#38BDF8" Style="{StaticResource CardValue}"/>
</StackPanel>
</StackPanel>
</Border>
<Border Grid.Row="2" Grid.Column="1" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="工作电压 / 电流" Style="{StaticResource CardTitle}"/>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding WorkingVoltage}" Style="{StaticResource CardValue}"/>
<TextBlock Text=" / " Foreground="#94A3B8" Style="{StaticResource CardValue}"/>
<TextBlock Text="{Binding WorkingCurrent}" Style="{StaticResource CardValue}"/>
</StackPanel>
</StackPanel>
</Border>
<Border Grid.Row="2" Grid.Column="2" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="急停按钮状态" Style="{StaticResource CardTitle}"/>
<TextBlock Text="{Binding EmergencyStop}" Style="{StaticResource CardValue}"/>
</StackPanel>
</Border>
<Border Grid.Row="2" Grid.Column="3" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="机场运行状态" Style="{StaticResource CardTitle}"/>
<TextBlock Text="{Binding DockState}" Style="{StaticResource CardValue}" FontSize="15"/>
</StackPanel>
</Border>
</Grid>
<!-- Drone OSD Layout -->
<Grid x:Name="GridDroneTelemetry" Visibility="Collapsed">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Row 0 -->
<Border Grid.Row="0" Grid.Column="0" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="无人机位置 (经, 纬, 高)" Style="{StaticResource CardTitle}"/>
<TextBlock Text="{Binding DronePosition}" Style="{StaticResource CardValue}" FontSize="15"/>
</StackPanel>
</Border>
<Border Grid.Row="0" Grid.Column="1" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="飞行姿态 (Pitch, Roll, Yaw)" Style="{StaticResource CardTitle}"/>
<TextBlock Text="{Binding DroneAttitude}" Style="{StaticResource CardValue}" FontSize="15"/>
</StackPanel>
</Border>
<Border Grid.Row="0" Grid.Column="2" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="速度 (水平, 垂直)" Style="{StaticResource CardTitle}"/>
<TextBlock Text="{Binding DroneSpeeds}" Style="{StaticResource CardValue}"/>
</StackPanel>
</Border>
<Border Grid.Row="0" Grid.Column="3" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="飞行器电池电量" Style="{StaticResource CardTitle}"/>
<TextBlock Text="{Binding DroneBattery}" Style="{StaticResource CardValue}"/>
</StackPanel>
</Border>
<!-- Row 1 -->
<Border Grid.Row="1" Grid.Column="0" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="飞行器搜星数" Style="{StaticResource CardTitle}"/>
<TextBlock Text="{Binding DroneSats}" Style="{StaticResource CardValue}"/>
</StackPanel>
</Border>
<Border Grid.Row="1" Grid.Column="1" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="飞行状态" Style="{StaticResource CardTitle}"/>
<TextBlock Text="{Binding DroneState}" Style="{StaticResource CardValue}"/>
</StackPanel>
</Border>
<Border Grid.Row="1" Grid.Column="2" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="状态发生原因" Style="{StaticResource CardTitle}"/>
<TextBlock Text="{Binding DroneStateReason}" Style="{StaticResource CardValue}" FontSize="15"/>
</StackPanel>
</Border>
<Border Grid.Row="1" Grid.Column="3" Style="{StaticResource TelemetryCard}">
<StackPanel>
<TextBlock Text="风速风向" Style="{StaticResource CardTitle}"/>
<TextBlock Text="{Binding WindSpeed}" Style="{StaticResource CardValue}"/>
</StackPanel>
</Border>
</Grid>
</Grid>
</ScrollViewer>
</TabItem>
<!-- TAB 2: DOCK REMOTE DEBUGGING SUITE -->
<TabItem Header="机场远程调试">
<Grid Margin="0,10,0,0">
<Grid.RowDefinitions>
<!-- Target Dock Header Bar -->
<RowDefinition Height="Auto"/>
<!-- Main Content Area -->
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- HEADER BAR: Gateway SN Selection & Debug Mode Quick Toggle -->
<Border Grid.Row="0" Style="{StaticResource CardBorder}" Margin="0,0,0,10" Padding="12,8">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="调试目标机场 SN:" Foreground="White" FontWeight="Bold" VerticalAlignment="Center" Margin="0,0,8,0"/>
<ComboBox x:Name="ComboDockDebugSn" Width="200" SelectionChanged="ComboDockDebugSn_SelectionChanged" ToolTip="选择或编辑机场网关 SN"/>
<Button x:Name="BtnRefreshDockSn" Content="刷新设备" Style="{StaticResource SecButton}" Click="BtnRefreshDockSn_Click" Margin="8,0,0,0" ToolTip="重新加载机场 SN 列表"/>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="调试模式:" Foreground="#94A3B8" VerticalAlignment="Center" Margin="0,0,8,0"/>
<Border x:Name="BadgeDebugModeState" Background="#334155" CornerRadius="4" Padding="8,4" Margin="0,0,12,0" VerticalAlignment="Center">
<TextBlock x:Name="TxtDebugModeBadge" Text="未知/未开启" Foreground="#94A3B8" FontSize="12" FontWeight="Bold"/>
</Border>
<Button x:Name="BtnOpenDebugMode" Content="开启调试模式" Click="BtnDockCmd_Click" Tag="debug_mode_open" Margin="0,0,6,0" ToolTip="发送 debug_mode_open 允许远程操控"/>
<Button x:Name="BtnCloseDebugMode" Content="关闭调试模式" Style="{StaticResource SecButton}" Click="BtnDockCmd_Click" Tag="debug_mode_close" ToolTip="发送 debug_mode_close 退出调试"/>
</StackPanel>
</Grid>
</Border>
<!-- MAIN SECTION (LEFT CONTROL CARDS, RIGHT COMMAND PREVIEW & EVENT LOG) -->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.2*"/>
<ColumnDefinition Width="8"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<!-- LEFT: DEBUG CONTROL CARDS (Scrollable) -->
<ScrollViewer Grid.Column="0" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Padding="0,0,6,0">
<StackPanel>
<!-- CARD 1: 🚪 舱盖与推杆控制 (Cover & Putter Control) -->
<Border Style="{StaticResource CardBorder}">
<StackPanel>
<TextBlock Text="🚪 舱盖与推杆控制 (Cover & Putter)" Foreground="#38BDF8" FontSize="14" FontWeight="Bold" Margin="0,0,0,8"/>
<Grid Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Content="打开舱盖" Click="BtnDockCmd_Click" Tag="cover_open" Margin="0,0,4,0" ToolTip="cover_open"/>
<Button Content="关闭舱盖" Click="BtnDockCmd_Click" Tag="cover_close" Grid.Column="1" Margin="2,0" ToolTip="cover_close"/>
<Button Content="强制关舱盖" Click="BtnDockCmd_Click" Tag="cover_force_close" Grid.Column="2" Style="{StaticResource DangerButton}" Margin="4,0,0,0" ToolTip="cover_force_close"/>
</Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Content="推杆展开" Click="BtnDockCmd_Click" Tag="putter_open" Margin="0,0,4,0" ToolTip="putter_open"/>
<Button Content="推杆闭合" Click="BtnDockCmd_Click" Tag="putter_close" Grid.Column="1" Margin="4,0,0,0" ToolTip="putter_close"/>
</Grid>
</StackPanel>
</Border>
<!-- CARD 2: 🚁 飞行器联动控制 (Aircraft Control) -->
<Border Style="{StaticResource CardBorder}">
<StackPanel>
<TextBlock Text="🚁 飞行器联动控制 (Aircraft Dock Control)" Foreground="#38BDF8" FontSize="14" FontWeight="Bold" Margin="0,0,0,8"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Content="飞行器开机" Click="BtnDockCmd_Click" Tag="drone_open" Margin="0,0,4,0" ToolTip="drone_open"/>
<Button Content="飞行器关机" Click="BtnDockCmd_Click" Tag="drone_close" Grid.Column="1" Margin="2,0" ToolTip="drone_close"/>
<Button Content="飞行器格式化" Click="BtnDockCmd_Click" Tag="drone_format" Grid.Column="2" Style="{StaticResource DangerButton}" Margin="4,0,0,0" ToolTip="drone_format"/>
</Grid>
</StackPanel>
</Border>
<!-- CARD 3: ⚡ 电源与辅助设备 (Power & Aux Equipment) -->
<Border Style="{StaticResource CardBorder}">
<StackPanel>
<TextBlock Text="⚡ 电源与辅助设备 (Power & Aux Control)" Foreground="#38BDF8" FontSize="14" FontWeight="Bold" Margin="0,0,0,8"/>
<Grid Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Content="开启充电" Click="BtnDockCmd_Click" Tag="charge_open" Margin="0,0,4,0" ToolTip="charge_open"/>
<Button Content="关闭充电" Click="BtnDockCmd_Click" Tag="charge_close" Grid.Column="1" Margin="4,0,0,0" ToolTip="charge_close"/>
</Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Content="开启补光灯" Click="BtnDockCmd_Click" Tag="supplement_light_open" Margin="0,0,4,0" ToolTip="supplement_light_open"/>
<Button Content="关闭补光灯" Click="BtnDockCmd_Click" Tag="supplement_light_close" Grid.Column="1" Margin="2,0" ToolTip="supplement_light_close"/>
<Button Content="警报开关" Click="BtnDockCmd_Click" Tag="alarm_state_switch" Grid.Column="2" Style="{StaticResource SecButton}" Margin="4,0,0,0" ToolTip="alarm_state_switch"/>
</Grid>
</StackPanel>
</Border>
<!-- CARD 4: ❄️ 舱内环境与空调设置 (Air Conditioner Control) -->
<Border Style="{StaticResource CardBorder}">
<StackPanel>
<TextBlock Text="❄️ 舱内环境与空调控制 (Air Conditioner Set)" Foreground="#38BDF8" FontSize="14" FontWeight="Bold" Margin="0,0,0,8"/>
<Grid Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="60"/>
</Grid.ColumnDefinitions>
<TextBlock Text="模式:" Foreground="White" VerticalAlignment="Center" Margin="0,0,6,0"/>
<ComboBox x:Name="ComboAcMode" Grid.Column="1" SelectedIndex="1">
<ComboBoxItem Content="0: 关闭 (Off)"/>
<ComboBoxItem Content="1: 自动 (Auto)"/>
<ComboBoxItem Content="2: 制冷 (Cool)"/>
<ComboBoxItem Content="3: 制热 (Heat)"/>
<ComboBoxItem Content="4: 除湿/通风 (Dehumidify)"/>
</ComboBox>
<TextBlock Grid.Column="2" Text="目标温度(℃):" Foreground="White" VerticalAlignment="Center" Margin="10,0,6,0"/>
<TextBox x:Name="TxtAcTargetTemp" Grid.Column="3" Text="25" VerticalAlignment="Center"/>
</Grid>
<Button Content="下发空调设置指令 (air_conditioner_set)" Click="BtnSetAirConditioner_Click" ToolTip="下发空调模式与目标温度"/>
</StackPanel>
</Border>
<!-- CARD 5: 🛠️ 系统重置与诊断 (System & Diagnostics) -->
<Border Style="{StaticResource CardBorder}">
<StackPanel>
<TextBlock Text="🛠️ 系统重置与诊断 (System & Diagnostics)" Foreground="#38BDF8" FontSize="14" FontWeight="Bold" Margin="0,0,0,8"/>
<Grid Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Content="一键起飞自检" Click="BtnDockCmd_Click" Tag="one_key_takeoff_check" Margin="0,0,4,0" ToolTip="one_key_takeoff_check"/>
<Button Content="远程日志上报" Click="BtnDockCmd_Click" Tag="remote_log_upload" Grid.Column="1" Style="{StaticResource SecButton}" Margin="4,0,0,0" ToolTip="remote_log_upload"/>
</Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Content="机场重启" Click="BtnDockCmd_Click" Tag="device_reboot" Style="{StaticResource DangerButton}" Margin="0,0,4,0" ToolTip="device_reboot"/>
<Button Content="机场数据格式化" Click="BtnDockCmd_Click" Tag="device_format" Grid.Column="1" Style="{StaticResource DangerButton}" Margin="4,0,0,0" ToolTip="device_format"/>
</Grid>
<!-- 🗺️ 自定义飞行区管理 -->
<Border Margin="0,8,0,0" Padding="8" Background="#0F172A" CornerRadius="4">
<StackPanel>
<TextBlock Text="🗺️ 自定义飞行区管理 (Flight Area)" Foreground="#38BDF8" FontSize="13" FontWeight="Bold" Margin="0,0,0,4"/>
<TextBlock Text="下发飞行区更新通知。收到机场数据请求时,工具将自动回应空文件列表以清空飞行区。" Foreground="#94A3B8" FontSize="11" TextWrapping="Wrap" Margin="0,0,0,6"/>
<Button Content="一键清空机场飞行区 (flight_areas_update)" Click="BtnDockCmd_Click" Tag="flight_areas_update" Style="{StaticResource DangerButton}" ToolTip="下发飞行区更新通知并自动清除机场及无人机自定义飞行区"/>
</StackPanel>
</Border>
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
<!-- SPLITTER -->
<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" Background="Transparent" ResizeBehavior="PreviousAndNext"/>
<!-- RIGHT: PAYLOAD PREVIEW & DOCK DEBUG FEED BACK -->
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<!-- Payload Preview -->
<RowDefinition Height="Auto"/>
<!-- Debug Feed Header -->
<RowDefinition Height="Auto"/>
<!-- Debug Feed Grid -->
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Payload Preview -->
<Border Grid.Row="0" Style="{StaticResource CardBorder}" Margin="0,0,0,8">
<StackPanel>
<TextBlock Text="最新生成的下发 JSON 载荷 (Payload Preview)" Foreground="White" FontSize="12" FontWeight="Bold" Margin="0,0,0,4"/>
<TextBox x:Name="TxtDockDebugPayloadPreview" Height="110" IsReadOnly="True" AcceptsReturn="True" TextWrapping="Wrap" FontFamily="Consolas" FontSize="12" Background="#090F19" Foreground="#34D399" Padding="6" VerticalScrollBarVisibility="Auto"/>
</StackPanel>
</Border>
<!-- Debug Feed Header -->
<Grid Grid.Row="1" Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="调试指令下发与进度响应日志 (Realtime Dock Feed)" Foreground="White" FontSize="13" FontWeight="Bold" VerticalAlignment="Center"/>
<Button x:Name="BtnCopyDockDebugLog" Grid.Column="1" Content="复制 JSON" Style="{StaticResource SecButton}" Click="BtnCopyDockDebugLog_Click" Margin="0,0,6,0"/>
<Button x:Name="BtnClearDockDebugLogs" Grid.Column="2" Content="清空调试日志" Style="{StaticResource DangerButton}" Click="BtnClearDockDebugLogs_Click"/>
</Grid>
<!-- Debug Feed Grid -->
<DataGrid x:Name="GridDockDebugLogs" Grid.Row="2"
AutoGenerateColumns="False"
Background="#0B0F19"
Foreground="White"
BorderThickness="1"
BorderBrush="#334155"
RowBackground="#0B0F19"
AlternatingRowBackground="#0F172A"
CanUserAddRows="False"
CanUserDeleteRows="False"
IsReadOnly="True"
HeadersVisibility="Column"
SelectionMode="Single"
GridLinesVisibility="Horizontal"
HorizontalGridLinesBrush="#334155"
FontFamily="Consolas"
SelectionChanged="GridDockDebugLogs_SelectionChanged">
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="#1E293B"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Padding" Value="8,4"/>
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.Columns>
<DataGridTextColumn Header="时间" Binding="{Binding Timestamp}" Width="80"/>
<DataGridTextColumn Header="调试动作 (Method)" Binding="{Binding MethodNameCn}" Width="130" Foreground="#38BDF8"/>
<DataGridTemplateColumn Header="执行状态" Width="100">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border Background="{Binding StatusColor}" CornerRadius="3" Padding="6,2" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock Text="{Binding Status}" Foreground="White" FontSize="11" FontWeight="Bold"/>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>