diff --git a/Trdo/App.xaml.cs b/Trdo/App.xaml.cs index e1857ad..65d57c5 100644 --- a/Trdo/App.xaml.cs +++ b/Trdo/App.xaml.cs @@ -1,6 +1,7 @@ using Microsoft.UI.Dispatching; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using Microsoft.Win32; using System; using System.ComponentModel; using System.Linq; @@ -240,12 +241,15 @@ private static bool IsSystemInDarkMode() { try { - UISettings uiSettings = new(); - Color foregroundColor = uiSettings.GetColorValue(UIColorType.Foreground); + // Read the system (taskbar) theme, not the app theme. + // SystemUsesLightTheme = 0 means dark taskbar, 1 means light taskbar. + using RegistryKey? key = Registry.CurrentUser.OpenSubKey( + @"SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"); + object? value = key?.GetValue("SystemUsesLightTheme"); + if (value is int intVal) + return intVal == 0; - // In dark mode, foreground color is light (high RGB values) - // In light mode, foreground color is dark (low RGB values) - return (foregroundColor.R + foregroundColor.G + foregroundColor.B) > 384; + return true; } catch { diff --git a/Trdo/Package.appxmanifest b/Trdo/Package.appxmanifest index d62c29c..09ba118 100644 --- a/Trdo/Package.appxmanifest +++ b/Trdo/Package.appxmanifest @@ -11,7 +11,7 @@ + Version="1.8.0.0" /> diff --git a/Trdo/Pages/PlayingPage.xaml b/Trdo/Pages/PlayingPage.xaml index 44c63cf..b19d889 100644 --- a/Trdo/Pages/PlayingPage.xaml +++ b/Trdo/Pages/PlayingPage.xaml @@ -18,6 +18,18 @@ + + + + + + + + + @@ -222,7 +234,17 @@ - + + + + + + diff --git a/Trdo/Pages/PlayingPage.xaml.cs b/Trdo/Pages/PlayingPage.xaml.cs index 50dc91f..4da53e9 100644 --- a/Trdo/Pages/PlayingPage.xaml.cs +++ b/Trdo/Pages/PlayingPage.xaml.cs @@ -1,6 +1,7 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls.Primitives; +using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Media; using System; using System.Diagnostics; @@ -64,6 +65,11 @@ private void PlayingPage_Loaded(object sender, RoutedEventArgs e) UpdateStationSelection(); UpdateFavoriteButtonState(); + // Restore volume slider visibility from persisted setting + VolumeControlGrid.Visibility = SettingsService.IsVolumeSliderVisible + ? Visibility.Visible + : Visibility.Collapsed; + // Find the ShellViewModel from the parent page _shellViewModel = FindShellViewModel(); Debug.WriteLine($"[PlayingPage] ShellViewModel found: {_shellViewModel != null}"); @@ -396,4 +402,32 @@ private void StationsListView_SelectionChanged(object sender, SelectionChangedEv Debug.WriteLine("=== StationsListView_SelectionChanged END ==="); } + + private void VolumeControl_PointerWheelChanged(object sender, PointerRoutedEventArgs e) + { + int delta = e.GetCurrentPoint((UIElement)sender).Properties.MouseWheelDelta; + double change = (delta / 120.0) * 0.02; + ViewModel.Volume = Math.Clamp(ViewModel.Volume + change, 0, 1); + e.Handled = true; + } + + private void HideVolumeSlider_Click(object sender, RoutedEventArgs e) + { + VolumeControlGrid.Visibility = Visibility.Collapsed; + SettingsService.IsVolumeSliderVisible = false; + } + + private void ShowVolumeSlider_Click(object sender, RoutedEventArgs e) + { + VolumeControlGrid.Visibility = Visibility.Visible; + SettingsService.IsVolumeSliderVisible = true; + } + + private void PageContextMenu_Opening(object sender, object e) + { + if (VolumeControlGrid.Visibility == Visibility.Visible) + { + ((MenuFlyout)sender).Hide(); + } + } } diff --git a/Trdo/Pages/SearchStation.xaml b/Trdo/Pages/SearchStation.xaml index b46863f..4b36c0e 100644 --- a/Trdo/Pages/SearchStation.xaml +++ b/Trdo/Pages/SearchStation.xaml @@ -73,67 +73,90 @@ ItemsSource="{x:Bind ViewModel.SearchResults, Mode=OneWay}" SelectionMode="None" Visibility="{x:Bind ViewModel.SearchResults.Count, Mode=OneWay, Converter={StaticResource HasItemsVisibilityConverter}}"> + + + - - - + - - - - + ColumnDefinitions="Auto,*" + ColumnSpacing="12" + RowDefinitions="Auto,Auto,Auto" + RowSpacing="4"> - - + + + + + + - - - - - - + + - - +