Skip to content

Commit

Permalink
CustomizeTheme: Enable\Disable Customization Controls.
Browse files Browse the repository at this point in the history
  • Loading branch information
MKKNinetyTwo authored and hackeranonymousdeepweb committed Nov 18, 2024
1 parent 8e1edb6 commit 118ed4d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
4 changes: 2 additions & 2 deletions RetroBar/PropertiesWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,10 @@
<TextBlock Name="HexColorText" VerticalAlignment="Center" Margin="10,0,10,0" />

<!-- Change Color Button -->
<Button Content="Change Color" Click="ChangeColorButton_Click" Margin="10,0,0,0" HorizontalAlignment="Right"/>
<Button Content="Change Color" Name="ChangeColorButton" Click="ChangeColorButton_Click" Margin="10,0,0,0" HorizontalAlignment="Right"/>

<!-- Reset Color Button -->
<Button Content="Reset Color" Click="ResetColorButton_Click" Margin="10,0,0,0" HorizontalAlignment="Right"/>
<Button Content="Reset Color" Name="ResetColorButton" Click="ResetColorButton_Click" Margin="10,0,0,0" HorizontalAlignment="Right"/>
</StackPanel>
</Grid>

Expand Down
20 changes: 18 additions & 2 deletions RetroBar/Utilities/CustomizeTheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,23 @@ private void SetupEventHandlers()
private void PropertiesWindow_Loaded(object sender, RoutedEventArgs e)
{
PopulateResourcesList();
// TODO: get EnableCustomizationControls value from settings
EnableCustomizationControls(false);
}

private void ThemeCustomizationsEnabled_CheckBox_OnChecked(object sender, RoutedEventArgs e)
{
// TODO: enable theme customizations
EnableCustomizationControls(true);

if (ResourcesList.SelectedItem is string selectedKey)
{
UpdateSelectedResourceDetails(selectedKey);
}
}

private void ThemeCustomizationsEnabled_CheckBox_OnUnChecked(object sender, RoutedEventArgs e)
{
// TODO: disable theme customizations
EnableCustomizationControls(false);
}

private void ChangeColorButton_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -154,6 +161,15 @@ private void PopulateResourcesList()
ResourcesList.ItemsSource = brushKeys;
}

private void EnableCustomizationControls(bool isEnabled)
{
ResourcesList.IsEnabled = isEnabled;
ChangeColorButton.IsEnabled = isEnabled;
ResetColorButton.IsEnabled = isEnabled;
SelectedColorBox.Fill = isEnabled ? Brushes.Transparent : Brushes.Gray;
HexColorText.Text = isEnabled ? string.Empty : "";
}

private static void ListAddUnique(List<string> list, string item)
{
if (!list.Contains(item))
Expand Down

0 comments on commit 118ed4d

Please sign in to comment.