From a214719ba1ec34d5e4f7db56fd344e0464ad20bb Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Thu, 10 Sep 2026 06:42:16 +0700 Subject: [PATCH 01/84] FAT M1: remove duplicate late navigation parity owner --- MainWindow.ProductionFatNavigationParity.cs | 173 -------------------- 1 file changed, 173 deletions(-) delete mode 100644 MainWindow.ProductionFatNavigationParity.cs diff --git a/MainWindow.ProductionFatNavigationParity.cs b/MainWindow.ProductionFatNavigationParity.cs deleted file mode 100644 index 61787678d..000000000 --- a/MainWindow.ProductionFatNavigationParity.cs +++ /dev/null @@ -1,173 +0,0 @@ -using System.Runtime.CompilerServices; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Threading; - -namespace ArIED61850Tester; - -/// -/// Extends the existing six-destination responsive nav contract to the dynamically-added -/// production FAT destination. The legacy MainWindow navigation code clamps index 6 to 5; -/// this late correction keeps Diagnostics from remaining highlighted while FAT is active -/// and moves the same selection pill into the seventh equal-width cell. -/// -internal static class MainWindowProductionFatNavigationParity -{ - private static readonly string[] NavigationButtonNames = - [ - "NavExplorerButton", - "NavLiveButton", - "NavEventsButton", - "NavAlarmButton", - "NavGooseButton", - "NavDiagnosticsButton", - "NavNativeFatButton" - ]; - - [ModuleInitializer] - internal static void Register() - { - EventManager.RegisterClassHandler( - typeof(MainWindow), - FrameworkElement.LoadedEvent, - new RoutedEventHandler(OnLoaded), - handledEventsToo: true); - EventManager.RegisterClassHandler( - typeof(MainWindow), - Button.ClickEvent, - new RoutedEventHandler(OnButtonClick), - handledEventsToo: true); - } - - private static void OnLoaded(object sender, RoutedEventArgs e) - { - if (sender is not MainWindow window) - return; - - window.SizeChanged -= Window_SizeChanged; - window.SizeChanged += Window_SizeChanged; - if (window.FindName("MainTabs") is TabControl tabs) - { - tabs.SelectionChanged -= Tabs_SelectionChanged; - tabs.SelectionChanged += Tabs_SelectionChanged; - } - Queue(window, animate: false); - } - - private static void OnButtonClick(object sender, RoutedEventArgs e) - { - if (sender is not MainWindow window || e.Source is not Button button || - !NavigationButtonNames.Contains(button.Name, StringComparer.Ordinal)) - { - return; - } - Queue(window, animate: true); - } - - private static void Tabs_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - if (sender is not TabControl tabs || !ReferenceEquals(e.Source, tabs) || - Window.GetWindow(tabs) is not MainWindow window) - { - return; - } - Queue(window, animate: true); - } - - private static void Window_SizeChanged(object sender, SizeChangedEventArgs e) - { - if (sender is MainWindow window) - Queue(window, animate: false); - } - - private static void Queue(MainWindow window, bool animate) - { - // Existing MainWindow + responsive-layout handlers still perform their historical - // six-slot correction. ApplicationIdle deliberately runs after those handlers so - // the seven-slot Engineering shell is the final visual authority. - window.Dispatcher.BeginInvoke( - DispatcherPriority.ApplicationIdle, - new Action(() => Apply(window, animate))); - } - - private static void Apply(MainWindow window, bool animate) - { - if (window.FindName("MainTabs") is not TabControl tabs || tabs.Items.Count < 7 || - window.FindName("WorkflowNavGrid") is not Grid grid || - window.FindName("WorkflowNavShell") is not Border shell || - window.FindName("WorkflowPill") is not Border pill) - { - return; - } - - var fatButton = grid.Children - .OfType +