Fix settings navigation and fix flicker on personalizaton nav.
This commit is contained in:
@@ -146,6 +146,9 @@ public class NewThemeService : INewThemeService
|
||||
get { return currentBackdropType; }
|
||||
set
|
||||
{
|
||||
// Only update if the backdrop type has actually changed
|
||||
if (currentBackdropType == value) return;
|
||||
|
||||
currentBackdropType = value;
|
||||
_configurationService.Set(WindowBackdropTypeKey, (int)value);
|
||||
|
||||
@@ -222,11 +225,14 @@ public class NewThemeService : INewThemeService
|
||||
_ => new MicaBackdrop() { Kind = Microsoft.UI.Composition.SystemBackdrops.MicaKind.Base }
|
||||
};
|
||||
|
||||
windowEx.SystemBackdrop = backdrop;
|
||||
if (windowEx.SystemBackdrop != backdrop)
|
||||
{
|
||||
windowEx.SystemBackdrop = backdrop;
|
||||
|
||||
BackdropChanged?.Invoke(this, backdropType);
|
||||
BackdropChanged?.Invoke(this, backdropType);
|
||||
|
||||
Debug.WriteLine($"Applied backdrop: {backdropType}");
|
||||
Debug.WriteLine($"Applied backdrop: {backdropType}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -284,11 +290,9 @@ public class NewThemeService : INewThemeService
|
||||
bool isDarkTheme = _underlyingThemeService.IsUnderlyingThemeDark();
|
||||
|
||||
// Set button colors based on theme
|
||||
// Background is always transparent for all buttons
|
||||
// Normal and inactive backgrounds are transparent, but hover/pressed have subtle backgrounds
|
||||
titleBar.ButtonBackgroundColor = Color.FromArgb(0, 0, 0, 0); // Transparent
|
||||
titleBar.ButtonInactiveBackgroundColor = Color.FromArgb(0, 0, 0, 0); // Transparent
|
||||
titleBar.ButtonHoverBackgroundColor = Color.FromArgb(0, 0, 0, 0); // Transparent
|
||||
titleBar.ButtonPressedBackgroundColor = Color.FromArgb(0, 0, 0, 0); // Transparent
|
||||
|
||||
if (isDarkTheme)
|
||||
{
|
||||
@@ -296,7 +300,11 @@ public class NewThemeService : INewThemeService
|
||||
titleBar.ButtonForegroundColor = Color.FromArgb(255, 255, 255, 255); // White
|
||||
titleBar.ButtonInactiveForegroundColor = Color.FromArgb(128, 255, 255, 255); // Semi-transparent white
|
||||
titleBar.ButtonHoverForegroundColor = Color.FromArgb(255, 255, 255, 255); // White
|
||||
titleBar.ButtonPressedForegroundColor = Color.FromArgb(200, 255, 255, 255); // Slightly dimmed white
|
||||
titleBar.ButtonPressedForegroundColor = Color.FromArgb(255, 255, 255, 255); // White
|
||||
|
||||
// Subtle hover and pressed backgrounds for dark theme
|
||||
titleBar.ButtonHoverBackgroundColor = Color.FromArgb(20, 255, 255, 255); // Very subtle white overlay
|
||||
titleBar.ButtonPressedBackgroundColor = Color.FromArgb(40, 255, 255, 255); // Slightly more visible white overlay
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -304,7 +312,11 @@ public class NewThemeService : INewThemeService
|
||||
titleBar.ButtonForegroundColor = Color.FromArgb(255, 0, 0, 0); // Black
|
||||
titleBar.ButtonInactiveForegroundColor = Color.FromArgb(128, 0, 0, 0); // Semi-transparent black
|
||||
titleBar.ButtonHoverForegroundColor = Color.FromArgb(255, 0, 0, 0); // Black
|
||||
titleBar.ButtonPressedForegroundColor = Color.FromArgb(200, 0, 0, 0); // Slightly dimmed black
|
||||
titleBar.ButtonPressedForegroundColor = Color.FromArgb(255, 0, 0, 0); // Black
|
||||
|
||||
// Subtle hover and pressed backgrounds for light theme
|
||||
titleBar.ButtonHoverBackgroundColor = Color.FromArgb(20, 0, 0, 0); // Very subtle black overlay
|
||||
titleBar.ButtonPressedBackgroundColor = Color.FromArgb(40, 0, 0, 0); // Slightly more visible black overlay
|
||||
}
|
||||
|
||||
Debug.WriteLine($"Updated title bar button colors for {(isDarkTheme ? "dark" : "light")} theme");
|
||||
|
||||
@@ -32,6 +32,12 @@ public sealed partial class ManageAccountsPage : ManageAccountsPageAbstract,
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
// Re-register message handlers after base.OnNavigatedTo unregisters all handlers
|
||||
WeakReferenceMessenger.Default.Register<BreadcrumbNavigationRequested>(this);
|
||||
WeakReferenceMessenger.Default.Register<BackBreadcrumNavigationRequested>(this);
|
||||
WeakReferenceMessenger.Default.Register<MergedInboxRenamed>(this);
|
||||
WeakReferenceMessenger.Default.Register<AccountUpdatedMessage>(this);
|
||||
|
||||
var initialRequest = new BreadcrumbNavigationRequested(Translator.MenuManageAccounts, WinoPage.AccountManagementPage);
|
||||
PageHistory.Add(new BreadcrumbNavigationItemViewModel(initialRequest, true));
|
||||
|
||||
@@ -40,6 +46,16 @@ public sealed partial class ManageAccountsPage : ManageAccountsPageAbstract,
|
||||
AccountPagesFrame.Navigate(accountManagementPageType, null, new SuppressNavigationTransitionInfo());
|
||||
}
|
||||
|
||||
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
|
||||
{
|
||||
// Explicitly unregister our message handlers before base.OnNavigatingFrom calls UnregisterAll
|
||||
WeakReferenceMessenger.Default.Unregister<BreadcrumbNavigationRequested>(this);
|
||||
WeakReferenceMessenger.Default.Unregister<BackBreadcrumNavigationRequested>(this);
|
||||
WeakReferenceMessenger.Default.Unregister<MergedInboxRenamed>(this);
|
||||
WeakReferenceMessenger.Default.Unregister<AccountUpdatedMessage>(this);
|
||||
|
||||
base.OnNavigatingFrom(e);
|
||||
}
|
||||
|
||||
void IRecipient<BreadcrumbNavigationRequested>.Receive(BreadcrumbNavigationRequested message)
|
||||
{
|
||||
|
||||
@@ -26,6 +26,9 @@ public sealed partial class SettingsPage : SettingsPageAbstract, IRecipient<Brea
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
// Re-register the breadcrumb navigation handler after base.OnNavigatedTo unregisters all handlers
|
||||
WeakReferenceMessenger.Default.Register<BreadcrumbNavigationRequested>(this);
|
||||
|
||||
SettingsFrame.Navigate(typeof(SettingOptionsPage), null, new SuppressNavigationTransitionInfo());
|
||||
|
||||
var initialRequest = new BreadcrumbNavigationRequested(Translator.MenuSettings, WinoPage.SettingOptionsPage);
|
||||
@@ -58,6 +61,14 @@ public sealed partial class SettingsPage : SettingsPageAbstract, IRecipient<Brea
|
||||
settingsHeader.Title = Translator.MenuSettings;
|
||||
}
|
||||
|
||||
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
|
||||
{
|
||||
// Explicitly unregister our message handlers before base.OnNavigatingFrom calls UnregisterAll
|
||||
WeakReferenceMessenger.Default.Unregister<BreadcrumbNavigationRequested>(this);
|
||||
|
||||
base.OnNavigatingFrom(e);
|
||||
}
|
||||
|
||||
void IRecipient<BreadcrumbNavigationRequested>.Receive(BreadcrumbNavigationRequested message)
|
||||
{
|
||||
var pageType = ViewModel.NavigationService.GetPageType(message.PageType);
|
||||
|
||||
Reference in New Issue
Block a user