-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisableDefender.GUI.ps1
More file actions
1807 lines (1692 loc) · 101 KB
/
Copy pathDisableDefender.GUI.ps1
File metadata and controls
1807 lines (1692 loc) · 101 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
#Requires -Version 5.1
<#
DisableDefender GUI v0.0.40
Safety-first WPF control center for the DisableDefender module
Features:
- Graphite/navy operations palette with accessible state hierarchy
- Live status tiles plus per-component lockdown/PPL dashboard
- Live policy edit stream with direct, ACL, and SYSTEM method icons
- Always-on firewall integrity banner with guard-trip flash
- Async worker runspace so the UI never blocks
- Streaming log pane with level colors + auto-scroll
- Confirmation modal for destructive ops
- Toast notifications for success/failure
- Tamper Protection banner with direct link to Windows Security
#>
[CmdletBinding()]
param()
# ---------------------------------------------------------------------------
# Self-elevate
# ---------------------------------------------------------------------------
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
$argList = "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`""
Start-Process -FilePath 'powershell.exe' -ArgumentList $argList -Verb RunAs
exit
}
# ---------------------------------------------------------------------------
# Hide console window (when launched directly via powershell.exe)
# ---------------------------------------------------------------------------
Add-Type -Namespace DisableDefenderGui -Name ConsoleCtl -MemberDefinition @'
[System.Runtime.InteropServices.DllImport("kernel32.dll")]
public static extern System.IntPtr GetConsoleWindow();
[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern bool ShowWindow(System.IntPtr hWnd, int nCmdShow);
'@ -ErrorAction SilentlyContinue
try {
$consoleHandle = [DisableDefenderGui.ConsoleCtl]::GetConsoleWindow()
if ($consoleHandle -ne [IntPtr]::Zero) {
[DisableDefenderGui.ConsoleCtl]::ShowWindow($consoleHandle, 0) | Out-Null
}
} catch {}
# ---------------------------------------------------------------------------
# WPF assemblies
# ---------------------------------------------------------------------------
Add-Type -AssemblyName PresentationFramework
Add-Type -AssemblyName PresentationCore
Add-Type -AssemblyName WindowsBase
Add-Type -AssemblyName System.Xaml
# ---------------------------------------------------------------------------
# Core module
# ---------------------------------------------------------------------------
$modulePath = Join-Path $PSScriptRoot 'DisableDefender.psd1'
if (-not (Test-Path -LiteralPath $modulePath)) {
[System.Windows.MessageBox]::Show("DisableDefender module manifest not found alongside GUI.`nExpected: $modulePath", 'DisableDefender', 'OK', 'Error') | Out-Null
exit 1
}
Import-Module -Name $modulePath -Force -ErrorAction Stop
$script:Version = (Get-Module -Name DisableDefender).Version.ToString()
$script:AppName = 'DisableDefender'
$script:AppDir = Join-Path $env:ProgramData $script:AppName
$script:LogPath = Join-Path $script:AppDir "$script:AppName.log"
if (-not (Test-Path -LiteralPath $script:AppDir)) {
New-Item -ItemType Directory -Path $script:AppDir -Force | Out-Null
}
# ---------------------------------------------------------------------------
# Synchronized UI state (queue for IPC between worker runspace and dispatcher)
# ---------------------------------------------------------------------------
$script:UIState = [hashtable]::Synchronized(@{
LogQueue = [System.Collections.Queue]::Synchronized([System.Collections.Queue]::new())
Busy = $false
LastAction = ''
LastResult = $null
StatusSnapshot = $null
})
# Override Write-Log in the main scope so Get-DefenderStatus calls from UI thread queue too.
function Write-Log {
param(
[Parameter(Mandatory)][string]$Message,
[ValidateSet('INFO','WARN','ERROR','OK','DEBUG')][string]$Level = 'INFO'
)
$stamp = (Get-Date).ToString('HH:mm:ss')
$entry = [PSCustomObject]@{ Time = $stamp; Level = $Level; Message = $Message }
$script:UIState.LogQueue.Enqueue($entry)
$fileLine = "[$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')] [$Level] $Message"
try { Add-Content -LiteralPath $script:LogPath -Value $fileLine -ErrorAction Stop } catch {}
}
# ---------------------------------------------------------------------------
# XAML - safety-first graphite control center
# ---------------------------------------------------------------------------
[xml]$xaml = @'
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="DisableDefender"
Width="1280" Height="820"
MinWidth="1100" MinHeight="700"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
ResizeMode="CanResize"
Background="#0B1220"
FontFamily="Segoe UI"
TextOptions.TextFormattingMode="Display"
TextOptions.TextRenderingMode="ClearType"
KeyboardNavigation.TabNavigation="Cycle"
AutomationProperties.Name="DisableDefender security control center">
<Window.Resources>
<!-- Graphite/navy palette -->
<SolidColorBrush x:Key="Base" Color="#0B1220"/>
<SolidColorBrush x:Key="Mantle" Color="#101A2A"/>
<SolidColorBrush x:Key="Crust" Color="#070D17"/>
<SolidColorBrush x:Key="Surface0" Color="#26354A"/>
<SolidColorBrush x:Key="Surface1" Color="#3A4B65"/>
<SolidColorBrush x:Key="Surface2" Color="#50627F"/>
<SolidColorBrush x:Key="Overlay0" Color="#8492AA"/>
<SolidColorBrush x:Key="Text" Color="#F3F6FB"/>
<SolidColorBrush x:Key="Subtext0" Color="#B5C0D2"/>
<SolidColorBrush x:Key="Subtext1" Color="#D2D9E5"/>
<SolidColorBrush x:Key="FirewallOkBg" Color="#10271F"/>
<SolidColorBrush x:Key="FirewallBadBg" Color="#321923"/>
<SolidColorBrush x:Key="Red" Color="#FF7088"/>
<SolidColorBrush x:Key="Maroon" Color="#F48C9D"/>
<SolidColorBrush x:Key="Peach" Color="#FFB86B"/>
<SolidColorBrush x:Key="Yellow" Color="#FFC857"/>
<SolidColorBrush x:Key="Green" Color="#56D97B"/>
<SolidColorBrush x:Key="Teal" Color="#5AD5C7"/>
<SolidColorBrush x:Key="Sky" Color="#67C8FF"/>
<SolidColorBrush x:Key="Blue" Color="#6EA8FE"/>
<SolidColorBrush x:Key="Lavender" Color="#AEBEFF"/>
<SolidColorBrush x:Key="Mauve" Color="#A493FF"/>
<SolidColorBrush x:Key="Pink" Color="#F1A3DB"/>
<!-- Scrollbar dark -->
<Style TargetType="ScrollBar">
<Setter Property="Background" Value="#0B1220"/>
<Setter Property="Width" Value="8"/>
</Style>
<!-- Base button -->
<Style x:Key="BaseButton" TargetType="Button">
<Setter Property="Foreground" Value="{StaticResource Text}"/>
<Setter Property="Background" Value="{StaticResource Surface0}"/>
<Setter Property="BorderBrush" Value="{StaticResource Surface1}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="12,9"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="bd"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="7"
SnapsToDevicePixels="True">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bd" Property="Background" Value="#31415A"/>
<Setter TargetName="bd" Property="BorderBrush" Value="#6EA8FE"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="bd" Property="Background" Value="#42536F"/>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter TargetName="bd" Property="BorderBrush" Value="#AEBEFF"/>
<Setter TargetName="bd" Property="BorderThickness" Value="2"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="bd" Property="Opacity" Value="0.4"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Primary action button (bigger, accent) -->
<Style x:Key="PrimaryAction" TargetType="Button" BasedOn="{StaticResource BaseButton}">
<Setter Property="Padding" Value="14,11"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="MinHeight" Value="50"/>
<Setter Property="Margin" Value="0,0,0,8"/>
</Style>
<!-- Danger action -->
<Style x:Key="DangerAction" TargetType="Button" BasedOn="{StaticResource PrimaryAction}">
<Setter Property="Background" Value="#2D1821"/>
<Setter Property="BorderBrush" Value="#FF7088"/>
<Setter Property="Foreground" Value="#FF8DA1"/>
</Style>
<!-- Success action -->
<Style x:Key="SuccessAction" TargetType="Button" BasedOn="{StaticResource PrimaryAction}">
<Setter Property="Background" Value="#14281D"/>
<Setter Property="BorderBrush" Value="#56D97B"/>
<Setter Property="Foreground" Value="#71E18E"/>
</Style>
<!-- Title bar icon button -->
<Style x:Key="ChromeButton" TargetType="Button" BasedOn="{StaticResource BaseButton}">
<Setter Property="Width" Value="44"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="bd" Background="{TemplateBinding Background}" CornerRadius="0">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bd" Property="Background" Value="#45475a"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Close button (red hover) -->
<Style x:Key="CloseButton" TargetType="Button" BasedOn="{StaticResource ChromeButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="bd" Background="{TemplateBinding Background}" CornerRadius="0">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bd" Property="Background" Value="#f38ba8"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Status tile container -->
<Style x:Key="Tile" TargetType="Border">
<Setter Property="Background" Value="{StaticResource Mantle}"/>
<Setter Property="BorderBrush" Value="{StaticResource Surface0}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="Padding" Value="15"/>
<Setter Property="Margin" Value="5"/>
</Style>
<!-- Section header -->
<Style x:Key="SectionHeader" TargetType="TextBlock">
<Setter Property="FontSize" Value="11"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="{StaticResource Subtext1}"/>
<Setter Property="Margin" Value="0,0,0,10"/>
<Setter Property="Text" Value=""/>
</Style>
<!-- TextBox dark -->
<Style TargetType="TextBox">
<Setter Property="Background" Value="{StaticResource Crust}"/>
<Setter Property="Foreground" Value="{StaticResource Text}"/>
<Setter Property="BorderBrush" Value="{StaticResource Surface0}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="8"/>
<Setter Property="CaretBrush" Value="{StaticResource Text}"/>
</Style>
<!-- Accessible dark checkbox -->
<Style TargetType="CheckBox">
<Setter Property="Foreground" Value="{StaticResource Subtext1}"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border x:Name="checkBox" Width="18" Height="18" CornerRadius="3" Background="{StaticResource Crust}"
BorderBrush="{StaticResource Surface2}" BorderThickness="1" VerticalAlignment="Center">
<Path x:Name="checkMark" Data="M3,8 L7,12 L15,4" Stroke="{StaticResource Base}" StrokeThickness="2"
StrokeStartLineCap="Round" StrokeEndLineCap="Round" Visibility="Collapsed"/>
</Border>
<ContentPresenter Grid.Column="1" Margin="9,0,0,0" VerticalAlignment="Center"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="checkBox" Property="Background" Value="{StaticResource Red}"/>
<Setter TargetName="checkBox" Property="BorderBrush" Value="{StaticResource Red}"/>
<Setter TargetName="checkMark" Property="Visibility" Value="Visible"/>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="True">
<Setter TargetName="checkBox" Property="BorderBrush" Value="{StaticResource Lavender}"/>
<Setter TargetName="checkBox" Property="BorderThickness" Value="2"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.45"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- RichTextBox dark for log -->
<Style TargetType="RichTextBox">
<Setter Property="Background" Value="{StaticResource Crust}"/>
<Setter Property="Foreground" Value="{StaticResource Text}"/>
<Setter Property="BorderBrush" Value="{StaticResource Surface0}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="IsReadOnly" Value="True"/>
<Setter Property="IsDocumentEnabled" Value="True"/>
<Setter Property="FontFamily" Value="Consolas"/>
<Setter Property="FontSize" Value="12"/>
</Style>
<!-- Progress bar -->
<Style TargetType="ProgressBar">
<Setter Property="Background" Value="{StaticResource Surface0}"/>
<Setter Property="Foreground" Value="{StaticResource Blue}"/>
<Setter Property="Height" Value="4"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
</Window.Resources>
<Border CornerRadius="0" Background="{StaticResource Base}" BorderBrush="{StaticResource Surface0}" BorderThickness="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="52"/> <!-- title bar -->
<RowDefinition Height="Auto"/> <!-- tamper banner -->
<RowDefinition Height="Auto"/> <!-- firewall banner -->
<RowDefinition Height="*"/> <!-- body -->
<RowDefinition Height="40"/> <!-- status bar -->
</Grid.RowDefinitions>
<!-- ============ TITLE BAR ============ -->
<Border x:Name="titleBar" Grid.Row="0" Background="#0C1524" BorderBrush="{StaticResource Surface0}" BorderThickness="0,0,0,1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="18,0,0,0">
<Viewbox Width="26" Height="26" Margin="0,0,10,0" AutomationProperties.Name="DisableDefender shield">
<Grid Width="24" Height="24">
<Path Data="M12,1.5 L21,5.1 L21,11.1 C21,16.7 17.4,20.7 12,22.7 C6.6,20.7 3,16.7 3,11.1 L3,5.1 Z"
Fill="{StaticResource Text}"/>
<TextBlock Text="D" Foreground="{StaticResource Base}" FontWeight="Bold" FontSize="10.5"
HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,1"/>
</Grid>
</Viewbox>
<TextBlock Text="DisableDefender" Foreground="{StaticResource Text}" FontSize="15" FontWeight="SemiBold" VerticalAlignment="Center"/>
<TextBlock x:Name="versionText" Text="v0.0.40" Foreground="{StaticResource Overlay0}" FontSize="11" Margin="10,2,0,0" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Horizontal">
<Button x:Name="btnMin" Style="{StaticResource ChromeButton}" Content="" FontFamily="Segoe MDL2 Assets"
Foreground="{StaticResource Subtext1}" ToolTip="Minimize" AutomationProperties.Name="Minimize window"/>
<Button x:Name="btnMax" Style="{StaticResource ChromeButton}" Content="" FontFamily="Segoe MDL2 Assets"
Foreground="{StaticResource Subtext1}" ToolTip="Maximize" AutomationProperties.Name="Maximize window"/>
<Button x:Name="btnClose" Style="{StaticResource CloseButton}" Content="" FontFamily="Segoe MDL2 Assets"
Foreground="{StaticResource Subtext1}" ToolTip="Close" AutomationProperties.Name="Close window"/>
</StackPanel>
</Grid>
</Border>
<!-- ============ TAMPER PROTECTION BANNER ============ -->
<Border x:Name="tamperBanner" Grid.Row="1" Background="{StaticResource FirewallBadBg}" BorderBrush="{StaticResource Red}"
BorderThickness="0,0,0,1" Padding="20,11" Visibility="Collapsed"
AutomationProperties.Name="Tamper Protection warning">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Vertical">
<TextBlock Text="Tamper Protection is blocking changes" FontWeight="SemiBold" Foreground="{StaticResource Red}" FontSize="13"/>
<TextBlock Text="Turn it off in Windows Security before continuing. DisableDefender will not attempt an unsupported bypass." Foreground="{StaticResource Subtext1}" FontSize="11" Margin="0,2,0,0"/>
</StackPanel>
<Button x:Name="btnOpenSecurity" Grid.Column="1" Style="{StaticResource BaseButton}" Content="Open Windows Security" Padding="12,6" FontSize="12"/>
</Grid>
</Border>
<!-- ============ FIREWALL INTEGRITY BANNER ============ -->
<Border x:Name="firewallBanner" Grid.Row="2" Margin="0" Background="{StaticResource FirewallOkBg}" BorderBrush="{StaticResource Green}"
BorderThickness="0,0,0,1" Padding="20,10" AutomationProperties.Name="Firewall integrity status">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Ellipse x:Name="firewallBannerDot" Grid.Column="0" Width="10" Height="10" Fill="{StaticResource Green}" VerticalAlignment="Center" Margin="0,0,12,0"/>
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock x:Name="firewallBannerTitle" Text="Firewall integrity protected" FontWeight="SemiBold" Foreground="{StaticResource Green}" FontSize="12.5" VerticalAlignment="Center"/>
<TextBlock x:Name="firewallBannerText" Text="mpssvc and BFE guarded; firewall profiles enabled" Foreground="{StaticResource Subtext1}" FontSize="11.5" Margin="14,0,0,0" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"/>
</StackPanel>
</Grid>
</Border>
<!-- ============ BODY ============ -->
<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="252"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- LEFT RAIL -->
<Border Grid.Column="0" Background="{StaticResource Mantle}" BorderBrush="{StaticResource Surface0}" BorderThickness="0,0,1,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Overall status indicator -->
<StackPanel Grid.Row="0" Margin="18,22,18,10">
<TextBlock Text="SECURITY STATE" Style="{StaticResource SectionHeader}"/>
<Border Padding="15" CornerRadius="8" Background="{StaticResource Base}" BorderBrush="{StaticResource Surface0}"
BorderThickness="1" AutomationProperties.Name="Overall Defender state">
<StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="42"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Width="34" Height="38" CornerRadius="7" Background="#172338"
BorderBrush="{StaticResource Surface1}" BorderThickness="1">
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Lavender}"
FontSize="19" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal">
<Ellipse x:Name="overallDot" Width="11" Height="11" Fill="{StaticResource Overlay0}" VerticalAlignment="Center"/>
<TextBlock x:Name="overallLabel" Text="CHECKING" Margin="9,0,0,0" Foreground="{StaticResource Text}"
FontSize="16" FontWeight="SemiBold" VerticalAlignment="Center"/>
</StackPanel>
<TextBlock x:Name="overallSubLabel" Text="Reading Defender state" Foreground="{StaticResource Subtext0}"
FontSize="11" Margin="0,4,0,0" TextWrapping="Wrap"/>
</StackPanel>
</Grid>
<Border Margin="0,14,0,0" Padding="0,11,0,0" BorderBrush="{StaticResource Surface0}" BorderThickness="0,1,0,0">
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="railFirewallIcon" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Overlay0}" FontSize="15" VerticalAlignment="Center"/>
<TextBlock x:Name="railFirewallText" Text="Checking Firewall boundary" Foreground="{StaticResource Subtext1}" FontSize="11.5" Margin="9,0,0,0" VerticalAlignment="Center"/>
</StackPanel>
</Border>
</StackPanel>
</Border>
</StackPanel>
<!-- Actions -->
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<StackPanel Margin="18,12,18,0">
<TextBlock Text="ACTIONS" Style="{StaticResource SectionHeader}"/>
<Button x:Name="btnDisable" Style="{StaticResource PrimaryAction}" AutomationProperties.Name="Disable Defender">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="28"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Blue}" FontSize="17" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="Disable Defender" VerticalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Overlay0}" FontSize="11" VerticalAlignment="Center"/>
</Grid>
</Button>
<Button x:Name="btnRemove" Style="{StaticResource DangerAction}" AutomationProperties.Name="Full Remove">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="28"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Red}" FontSize="17" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="Full Remove" VerticalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Red}" FontSize="11" VerticalAlignment="Center"/>
</Grid>
</Button>
<Button x:Name="btnRestore" Style="{StaticResource SuccessAction}" AutomationProperties.Name="Restore Defender">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="28"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Green}" FontSize="17" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="Restore Defender" VerticalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Green}" FontSize="11" VerticalAlignment="Center"/>
</Grid>
</Button>
<Button x:Name="btnRepair" Style="{StaticResource PrimaryAction}" AutomationProperties.Name="Repair Defender defaults">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="28"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Lavender}" FontSize="17" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="Repair defaults" VerticalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="NO UNDO" Foreground="{StaticResource Overlay0}" FontSize="9" VerticalAlignment="Center"/>
</Grid>
</Button>
<Button x:Name="btnRefresh" Style="{StaticResource PrimaryAction}" AutomationProperties.Name="Refresh security status">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="28"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Lavender}" FontSize="17" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="Refresh status" VerticalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="F5" Foreground="{StaticResource Overlay0}" FontSize="10" VerticalAlignment="Center"/>
</Grid>
</Button>
</StackPanel>
</ScrollViewer>
<!-- System info -->
<Border Grid.Row="2" Margin="18,0,18,18" Padding="14" CornerRadius="8" Background="{StaticResource Base}" BorderBrush="{StaticResource Surface0}"
BorderThickness="1" AutomationProperties.Name="System context">
<StackPanel>
<TextBlock Text="SYSTEM CONTEXT" Style="{StaticResource SectionHeader}"/>
<Grid Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="OS build" Foreground="{StaticResource Subtext0}" FontSize="11"/>
<TextBlock Grid.Column="1" x:Name="sysOsText" Text="-" Foreground="{StaticResource Subtext1}" FontSize="11"/>
</Grid>
<Grid Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Safe mode" Foreground="{StaticResource Subtext0}" FontSize="11"/>
<TextBlock Grid.Column="1" x:Name="sysSafeText" Text="-" Foreground="{StaticResource Subtext1}" FontSize="11"/>
</Grid>
<Grid Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Elevated" Foreground="{StaticResource Subtext0}" FontSize="11"/>
<TextBlock Grid.Column="1" x:Name="sysElevText" Text="Yes" Foreground="{StaticResource Green}" FontSize="11"/>
</Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Tamper protection" Foreground="{StaticResource Subtext0}" FontSize="11"/>
<TextBlock Grid.Column="1" x:Name="sysTamperText" Text="-" Foreground="{StaticResource Subtext1}" FontSize="11"/>
</Grid>
</StackPanel>
</Border>
</Grid>
</Border>
<!-- RIGHT PANE -->
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <!-- workspace heading -->
<RowDefinition Height="Auto"/> <!-- tiles -->
<RowDefinition Height="*"/> <!-- component dashboard -->
<RowDefinition Height="112"/> <!-- log -->
</Grid.RowDefinitions>
<!-- Workspace heading -->
<Grid Grid.Row="0" Margin="20,18,20,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Width="42" Height="42" CornerRadius="8" Background="#172338"
BorderBrush="{StaticResource Surface0}" BorderThickness="1" Margin="0,0,13,0">
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Lavender}" FontSize="22"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<TextBlock Text="Security Control Center" Foreground="{StaticResource Text}" FontSize="20" FontWeight="SemiBold"/>
<TextBlock Text="Monitor Defender state, verify safety boundaries, and recover with confidence."
Foreground="{StaticResource Subtext0}" FontSize="11.5" Margin="0,3,0,0"/>
</StackPanel>
</Grid>
<!-- Status tiles grid -->
<Grid Grid.Row="1" Margin="15,4,15,7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Tile: Antivirus -->
<Border Grid.Row="0" Grid.Column="0" Style="{StaticResource Tile}" AutomationProperties.Name="Antivirus status">
<StackPanel>
<Grid Margin="0,0,0,9">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="26"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Lavender}" FontSize="17"/>
<TextBlock Grid.Column="1" Text="Antivirus" Foreground="{StaticResource Text}" FontWeight="SemiBold" FontSize="12.5"/>
<TextBlock Grid.Column="2" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Overlay0}" FontSize="10"/>
</Grid>
<StackPanel Orientation="Horizontal">
<Ellipse x:Name="dotAV" Width="10" Height="10" Fill="{StaticResource Overlay0}" VerticalAlignment="Center"/>
<TextBlock x:Name="valAV" Text="-" Margin="9,0,0,0" Foreground="{StaticResource Text}" FontSize="21" FontWeight="SemiBold"/>
</StackPanel>
<TextBlock x:Name="subAV" Text="WinDefend service" Foreground="{StaticResource Subtext0}" FontSize="11" Margin="0,5,0,0" TextTrimming="CharacterEllipsis"/>
</StackPanel>
</Border>
<!-- Tile: Real-time -->
<Border Grid.Row="0" Grid.Column="1" Style="{StaticResource Tile}" AutomationProperties.Name="Real-time protection status">
<StackPanel>
<Grid Margin="0,0,0,9">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="26"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Lavender}" FontSize="17"/>
<TextBlock Grid.Column="1" Text="Real-time" Foreground="{StaticResource Text}" FontWeight="SemiBold" FontSize="12.5"/>
<TextBlock Grid.Column="2" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Overlay0}" FontSize="10"/>
</Grid>
<StackPanel Orientation="Horizontal">
<Ellipse x:Name="dotRT" Width="10" Height="10" Fill="{StaticResource Overlay0}" VerticalAlignment="Center"/>
<TextBlock x:Name="valRT" Text="-" Margin="9,0,0,0" Foreground="{StaticResource Text}" FontSize="21" FontWeight="SemiBold"/>
</StackPanel>
<TextBlock x:Name="subRT" Text="Behavior + IOAV + script scan" Foreground="{StaticResource Subtext0}" FontSize="11" Margin="0,5,0,0" TextTrimming="CharacterEllipsis"/>
</StackPanel>
</Border>
<!-- Tile: Tamper Protection -->
<Border Grid.Row="0" Grid.Column="2" Style="{StaticResource Tile}" AutomationProperties.Name="Tamper Protection status">
<StackPanel>
<Grid Margin="0,0,0,9">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="26"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Lavender}" FontSize="17"/>
<TextBlock Grid.Column="1" Text="Tamper Protection" Foreground="{StaticResource Text}" FontWeight="SemiBold" FontSize="12.5"/>
<TextBlock Grid.Column="2" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Overlay0}" FontSize="10"/>
</Grid>
<StackPanel Orientation="Horizontal">
<Ellipse x:Name="dotTP" Width="10" Height="10" Fill="{StaticResource Overlay0}" VerticalAlignment="Center"/>
<TextBlock x:Name="valTP" Text="-" Margin="9,0,0,0" Foreground="{StaticResource Text}" FontSize="21" FontWeight="SemiBold"/>
</StackPanel>
<TextBlock x:Name="subTP" Text="Must be OFF to proceed" Foreground="{StaticResource Subtext0}" FontSize="11" Margin="0,5,0,0" TextTrimming="CharacterEllipsis"/>
</StackPanel>
</Border>
<!-- Tile: Firewall -->
<Border Grid.Row="1" Grid.Column="0" Style="{StaticResource Tile}" AutomationProperties.Name="Firewall status">
<StackPanel>
<Grid Margin="0,0,0,9">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="26"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Lavender}" FontSize="17"/>
<TextBlock Grid.Column="1" Text="Firewall" Foreground="{StaticResource Text}" FontWeight="SemiBold" FontSize="12.5"/>
<TextBlock Grid.Column="2" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Overlay0}" FontSize="10"/>
</Grid>
<StackPanel Orientation="Horizontal">
<Ellipse x:Name="dotFW" Width="10" Height="10" Fill="{StaticResource Overlay0}" VerticalAlignment="Center"/>
<TextBlock x:Name="valFW" Text="-" Margin="9,0,0,0" Foreground="{StaticResource Text}" FontSize="21" FontWeight="SemiBold"/>
</StackPanel>
<TextBlock x:Name="subFW" Text="mpssvc + BFE preserved" Foreground="{StaticResource Subtext0}" FontSize="11" Margin="0,5,0,0" TextTrimming="CharacterEllipsis"/>
</StackPanel>
</Border>
<!-- Tile: Services -->
<Border Grid.Row="1" Grid.Column="1" Style="{StaticResource Tile}" AutomationProperties.Name="Defender services status">
<StackPanel>
<Grid Margin="0,0,0,9">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="26"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Lavender}" FontSize="17"/>
<TextBlock Grid.Column="1" Text="Defender Services" Foreground="{StaticResource Text}" FontWeight="SemiBold" FontSize="12.5"/>
<TextBlock Grid.Column="2" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Overlay0}" FontSize="10"/>
</Grid>
<StackPanel Orientation="Horizontal">
<Ellipse x:Name="dotSvc" Width="10" Height="10" Fill="{StaticResource Overlay0}" VerticalAlignment="Center"/>
<TextBlock x:Name="valSvc" Text="-" Margin="9,0,0,0" Foreground="{StaticResource Text}" FontSize="21" FontWeight="SemiBold"/>
</StackPanel>
<TextBlock x:Name="subSvc" Text="Disabled / Total" Foreground="{StaticResource Subtext0}" FontSize="11" Margin="0,5,0,0" TextTrimming="CharacterEllipsis"/>
</StackPanel>
</Border>
<!-- Tile: Passive Mode -->
<Border Grid.Row="1" Grid.Column="2" Style="{StaticResource Tile}" AutomationProperties.Name="MAPS telemetry status">
<StackPanel>
<Grid Margin="0,0,0,9">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="26"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Lavender}" FontSize="17"/>
<TextBlock Grid.Column="1" Text="MAPS" Foreground="{StaticResource Text}" FontWeight="SemiBold" FontSize="12.5"/>
<TextBlock Grid.Column="2" Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Overlay0}" FontSize="10"/>
</Grid>
<StackPanel Orientation="Horizontal">
<Ellipse x:Name="dotMAPS" Width="10" Height="10" Fill="{StaticResource Overlay0}" VerticalAlignment="Center"/>
<TextBlock x:Name="valMAPS" Text="-" Margin="9,0,0,0" Foreground="{StaticResource Text}" FontSize="21" FontWeight="SemiBold"/>
</StackPanel>
<TextBlock x:Name="subMAPS" Text="Cloud-based protection" Foreground="{StaticResource Subtext0}" FontSize="11" Margin="0,5,0,0" TextTrimming="CharacterEllipsis"/>
</StackPanel>
</Border>
</Grid>
<!-- Component dashboard -->
<Grid Grid.Row="2" Margin="20,4,20,8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Background="{StaticResource Mantle}" BorderBrush="{StaticResource Surface0}" BorderThickness="1"
CornerRadius="8" Padding="13" AutomationProperties.Name="Component health">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Margin="0,0,0,10">
<TextBlock Text="Component health" Foreground="{StaticResource Text}" FontSize="12.5" FontWeight="SemiBold"/>
<TextBlock x:Name="componentSubtitle" Text="Service, driver, and protection posture" Foreground="{StaticResource Subtext0}" FontSize="10.5" Margin="0,2,0,0"/>
</StackPanel>
<ScrollViewer Grid.Row="1" MaxHeight="172" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<WrapPanel x:Name="componentTilePanel"/>
</ScrollViewer>
</Grid>
</Border>
<Border Grid.Column="2" Background="{StaticResource Mantle}" BorderBrush="{StaticResource Surface0}" BorderThickness="1"
CornerRadius="8" Padding="13" AutomationProperties.Name="Policy changes">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Margin="0,0,0,10">
<TextBlock Text="Policy changes" Foreground="{StaticResource Text}" FontSize="12.5" FontWeight="SemiBold"/>
<TextBlock Text="Latest privileged configuration events" Foreground="{StaticResource Subtext0}" FontSize="10.5" Margin="0,2,0,0"/>
</StackPanel>
<ScrollViewer Grid.Row="1" MaxHeight="172" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<StackPanel x:Name="policyStreamPanel">
<StackPanel x:Name="policyEmptyState" Margin="4,20,4,16" HorizontalAlignment="Center">
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" Foreground="{StaticResource Overlay0}" FontSize="22"
HorizontalAlignment="Center"/>
<TextBlock Text="No policy changes in this session" Foreground="{StaticResource Subtext1}" FontSize="11.5"
FontWeight="SemiBold" Margin="0,8,0,0" HorizontalAlignment="Center"/>
<TextBlock Text="Verified changes will appear here as they occur." Foreground="{StaticResource Subtext0}" FontSize="10.5"
Margin="0,3,0,0" HorizontalAlignment="Center"/>
</StackPanel>
</StackPanel>
</ScrollViewer>
</Grid>
</Border>
</Grid>
<!-- Log panel -->
<Border Grid.Row="3" Margin="20,0,20,10" CornerRadius="8" Background="{StaticResource Mantle}" BorderBrush="{StaticResource Surface0}"
BorderThickness="1" AutomationProperties.Name="Live activity">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="14,10,12,9">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock Text="Live activity" Foreground="{StaticResource Text}" FontSize="12.5" FontWeight="SemiBold"/>
<TextBlock Text="Structured local operation output" Foreground="{StaticResource Subtext0}" FontSize="10.5" Margin="0,2,0,0"/>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<Button x:Name="btnCopyLog" Style="{StaticResource BaseButton}" Content="Copy" Padding="10,5" FontSize="11" Margin="0,0,6,0"
AutomationProperties.Name="Copy live activity"/>
<Button x:Name="btnExportLog" Style="{StaticResource BaseButton}" Content="Export" Padding="10,5" FontSize="11" Margin="0,0,6,0"
AutomationProperties.Name="Export live activity"/>
<Button x:Name="btnClearLog" Style="{StaticResource BaseButton}" Content="Clear" Padding="10,5" FontSize="11"
AutomationProperties.Name="Clear live activity"/>
</StackPanel>
</Grid>
<RichTextBox x:Name="logBox" Grid.Row="1" Margin="14,0,14,14" VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled" AutomationProperties.Name="Live activity log">
<FlowDocument>
<Paragraph x:Name="logPara" Margin="0"/>
</FlowDocument>
</RichTextBox>
</Grid>
</Border>
</Grid>
</Grid>
<!-- ============ STATUS BAR ============ -->
<Border Grid.Row="4" Background="#0C1524" BorderBrush="{StaticResource Surface0}" BorderThickness="0,1,0,0">
<Grid Margin="18,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="170"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ProgressBar Grid.Column="0" x:Name="progressBar" IsIndeterminate="False" VerticalAlignment="Center" Width="154"
AutomationProperties.Name="Operation progress"/>
<TextBlock Grid.Column="1" x:Name="statusText" Text="Idle" Foreground="{StaticResource Subtext0}" FontSize="11.5"
VerticalAlignment="Center" Margin="12,0,0,0" AutomationProperties.LiveSetting="Polite"/>
<TextBlock Grid.Column="2" x:Name="footerText" Text="LOCAL ONLY • FIREWALL BOUNDARY ENFORCED"
Foreground="{StaticResource Subtext0}" FontSize="10.5" FontWeight="SemiBold" VerticalAlignment="Center"/>
</Grid>
</Border>
<!-- ============ TOAST OVERLAY ============ -->
<Border x:Name="toast" Grid.Row="3" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,24,24"
Background="{StaticResource Mantle}" BorderBrush="{StaticResource Mauve}" BorderThickness="1" CornerRadius="8"
Padding="16,12" MaxWidth="390" Visibility="Collapsed" AutomationProperties.LiveSetting="Polite">
<StackPanel Orientation="Horizontal">
<Ellipse x:Name="toastDot" Width="8" Height="8" Fill="{StaticResource Mauve}" VerticalAlignment="Center"/>
<TextBlock x:Name="toastText" Text="" Foreground="{StaticResource Text}" FontSize="13" Margin="12,0,0,0" VerticalAlignment="Center" TextWrapping="Wrap"/>
</StackPanel>
</Border>
<!-- ============ CONFIRMATION OVERLAY ============ -->
<Grid x:Name="confirmOverlay" Grid.Row="0" Grid.RowSpan="5" Background="#E0070D17" Visibility="Collapsed"
KeyboardNavigation.TabNavigation="Cycle">
<Border Background="{StaticResource Mantle}" BorderBrush="{StaticResource Surface1}" BorderThickness="1" CornerRadius="10"
Padding="30" MaxWidth="700" HorizontalAlignment="Center" VerticalAlignment="Center"
AutomationProperties.Name="Action confirmation">
<StackPanel>
<TextBlock Text="REVIEW OPERATION" Foreground="{StaticResource Yellow}" FontSize="10.5" FontWeight="SemiBold"/>
<TextBlock x:Name="confirmTitle" Text="Confirm action" Foreground="{StaticResource Text}" FontSize="20" FontWeight="SemiBold" Margin="0,6,0,0"/>
<TextBlock x:Name="confirmBody" Text="" Foreground="{StaticResource Subtext1}" FontSize="13" LineHeight="19"
Margin="0,10,0,0" TextWrapping="Wrap"/>
<Border x:Name="confirmDiffPanel" Visibility="Collapsed" Margin="0,14,0,0" Padding="12"
Background="{StaticResource Mantle}" BorderBrush="{StaticResource Surface1}" BorderThickness="1" CornerRadius="8">
<StackPanel>
<TextBlock Text="CURRENT → TARGET" Foreground="{StaticResource Subtext1}" FontSize="10.5" FontWeight="SemiBold" Margin="0,0,0,8"/>
<ScrollViewer MaxHeight="220" VerticalScrollBarVisibility="Auto">
<TextBlock x:Name="confirmDiffText" Text="" Foreground="{StaticResource Text}" FontSize="11" FontFamily="Consolas" TextWrapping="NoWrap"/>
</ScrollViewer>
</StackPanel>
</Border>
<Border x:Name="confirmForcePanel" Visibility="Collapsed" Margin="0,14,0,0" Padding="12"
Background="{StaticResource Mantle}" BorderBrush="{StaticResource Red}" BorderThickness="1" CornerRadius="8">
<CheckBox x:Name="confirmForceOverride"
Content="Override safety gates (-Force)"
Foreground="{StaticResource Red}"
FontSize="12"
AutomationProperties.Name="Override safety gates for this run"
ToolTip="Bypasses Tamper Protection, managed-device, and Safe Mode refusal gates for this run only."/>
</Border>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,20,0,0">
<Button x:Name="btnConfirmCancel" Style="{StaticResource BaseButton}" Content="Cancel" Padding="18,9"
Margin="0,0,10,0" IsCancel="True" AutomationProperties.Name="Cancel operation"/>
<Button x:Name="btnConfirmOk" Style="{StaticResource DangerAction}" Content="Proceed" Padding="18,9"
Margin="0" IsDefault="True" AutomationProperties.Name="Proceed with operation"/>
</StackPanel>
</StackPanel>
</Border>
</Grid>
</Grid>
</Border>
</Window>
'@
# ---------------------------------------------------------------------------
# Parse XAML
# ---------------------------------------------------------------------------
$reader = New-Object System.Xml.XmlNodeReader $xaml
$window = [System.Windows.Markup.XamlReader]::Load($reader)
# Lookup table for named elements
$ui = @{}
$xaml.SelectNodes('//*[@*[local-name()="Name"]]') | ForEach-Object {
$name = $_.Attributes['x:Name'].Value
if ($name) { $ui[$name] = $window.FindName($name) }
}
# ---------------------------------------------------------------------------
# Helpers
# ---------------------------------------------------------------------------
function Set-TileState {
param(
[string]$DotName,
[string]$ValName,
[string]$SubName,
$Value,
[string]$GoodText = 'OFF',
[string]$BadText = 'ON',
[switch]$InvertColor, # when "ON" means bad
[string]$SubText
)
$dot = $ui[$DotName]; $val = $ui[$ValName]; $sub = $ui[$SubName]
if ($null -eq $val) { return }
if ($null -eq $Value) {
$val.Text = 'N/A'
$val.Foreground = $window.Resources['Yellow']
$dot.Fill = $window.Resources['Yellow']
if ($SubText) { $sub.Text = $SubText }
return
}
$val.Foreground = $window.Resources['Text']
$isOn = [bool]$Value
if ($isOn) {
$val.Text = $BadText
$dot.Fill = if ($InvertColor) { $window.Resources['Red'] } else { $window.Resources['Green'] }
} else {
$val.Text = $GoodText
$dot.Fill = if ($InvertColor) { $window.Resources['Green'] } else { $window.Resources['Overlay0'] }
}
if ($SubText) { $sub.Text = $SubText }
}
function New-ComponentText {
param(
[string]$Text,
[int]$FontSize = 11,
[string]$Resource = 'Text',
[switch]$Bold
)
$block = [System.Windows.Controls.TextBlock]::new()
$block.Text = $Text
$block.FontSize = $FontSize
$block.Foreground = $window.Resources[$Resource]
$block.TextTrimming = [System.Windows.TextTrimming]::CharacterEllipsis
if ($Bold) { $block.FontWeight = 'SemiBold' }
return $block
}
function Add-ComponentTile {
param([Parameter(Mandatory)]$Component)
$border = [System.Windows.Controls.Border]::new()
$border.Width = 168
$border.Height = 82
$border.Margin = [System.Windows.Thickness]::new(0, 0, 8, 8)
$border.Padding = [System.Windows.Thickness]::new(10)
$border.CornerRadius = [System.Windows.CornerRadius]::new(6)
$border.Background = $window.Resources['Crust']
$border.BorderThickness = [System.Windows.Thickness]::new(1)
switch ($Component.DisableTargetDrift) {
'OK' {
$dotBrush = $window.Resources['Green']
$border.BorderBrush = $window.Resources['Surface1']
$stateText = 'LOCKED'
}
'Drift' {
$dotBrush = $window.Resources['Yellow']
$border.BorderBrush = $window.Resources['Surface1']
$stateText = $Component.CurrentStart
}
default {
$dotBrush = $window.Resources['Overlay0']
$border.BorderBrush = $window.Resources['Surface0']
$stateText = 'UNKNOWN'
}
}