From 990a6ba488f348f9a0f2d5f6474e38c41896e32f Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 1 Feb 2019 23:16:46 -0600 Subject: [PATCH] Fix refreshing the selected diags button. --- smx-config/DiagnosticsWidgets.cs | 25 +++++++++++++++++++++++++ smx-config/MainWindow.xaml | 18 +++++++++--------- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/smx-config/DiagnosticsWidgets.cs b/smx-config/DiagnosticsWidgets.cs index ca7884c..d41ec5f 100644 --- a/smx-config/DiagnosticsWidgets.cs +++ b/smx-config/DiagnosticsWidgets.cs @@ -244,6 +244,8 @@ namespace smx_config private void Refresh(LoadFromConfigDelegateArgs args) { + RefreshSelectedPanel(); + P1Diagnostics.Visibility = args.controller[0].info.connected? Visibility.Visible:Visibility.Collapsed; P2Diagnostics.Visibility = args.controller[1].info.connected? Visibility.Visible:Visibility.Collapsed; @@ -327,5 +329,28 @@ namespace smx_config } } + + // Update the selected color picker based on the value of selectedButton. + private void RefreshSelectedPanel() + { + LoadFromConfigDelegateArgs args = CurrentSMXDevice.singleton.GetState(); + + DiagnosticsPanelButton[] buttons = getPanelSelectionButtons(); + + // Tell the buttons which one is selected. + foreach(DiagnosticsPanelButton button in buttons) + button.IsSelected = button.Panel == SelectedPanel; + } + + // Return all panel selection buttons. + DiagnosticsPanelButton[] getPanelSelectionButtons() + { + DiagnosticsPanelButton[] result = new DiagnosticsPanelButton[9]; + for(int i = 0; i < 9; ++i) + { + result[i] = Template.FindName("Panel" + i, this) as DiagnosticsPanelButton; + } + return result; + } } } diff --git a/smx-config/MainWindow.xaml b/smx-config/MainWindow.xaml index 46dee7e..c54b1b2 100644 --- a/smx-config/MainWindow.xaml +++ b/smx-config/MainWindow.xaml @@ -491,17 +491,17 @@ Use if the platform is too sensitive. - - - + + + - - - + + + - - - + + +