Skip to content

Commit

Permalink
Remove windows 10 effects
Browse files Browse the repository at this point in the history
  • Loading branch information
Nice3point committed Dec 26, 2023
1 parent b08b02f commit d8fa93f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion source/RevitLookup.UI/Controls/Window/WindowBackdrop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static bool IsSupported(WindowBackdropType backdropType)
WindowBackdropType.Auto => Win32.Utilities.IsOSWindows11Insider1OrNewer,
WindowBackdropType.Tabbed => Win32.Utilities.IsOSWindows11Insider1OrNewer,
WindowBackdropType.Mica => Win32.Utilities.IsOSWindows11OrNewer,
WindowBackdropType.Acrylic => Win32.Utilities.IsOSWindows7OrNewer,
WindowBackdropType.Acrylic => Win32.Utilities.IsOSWindows11OrNewer,
WindowBackdropType.None => true,
_ => false
};
Expand Down
6 changes: 5 additions & 1 deletion source/RevitLookup.UI/ForkModificationList.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,8 @@
# Wpf.Ui.Resources.Typography

- TitleTextBlockStyle FontSize set 18
- TitleTextBlockStyle LineHeight set 18
- TitleTextBlockStyle LineHeight set 18

# Wpf.Ui.Controls.WindowBackdrop

- Increased WindowBackdropType.Acrylic supported OS
38 changes: 20 additions & 18 deletions source/RevitLookup/ViewModels/Pages/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,16 @@
// (Rights in Technical Data and Computer Software), as applicable.

using CommunityToolkit.Mvvm.ComponentModel;
using RevitLookup.Services;
using RevitLookup.Services.Contracts;
using Wpf.Ui;
using Wpf.Ui.Appearance;
using Wpf.Ui.Controls;
using static Wpf.Ui.Win32.Utilities;

namespace RevitLookup.ViewModels.Pages;

public sealed partial class SettingsViewModel(
ISettingsService settingsService,
INavigationService navigationService,
NotificationService notificationService,
IWindow window)
: ObservableObject
{
Expand All @@ -50,30 +47,18 @@ public sealed partial class SettingsViewModel(
// ApplicationTheme.HighContrast
];

public List<WindowBackdropType> BackgroundEffects { get; } =
[
WindowBackdropType.None,
WindowBackdropType.Acrylic,
WindowBackdropType.Tabbed,
WindowBackdropType.Mica
];
public List<WindowBackdropType> BackgroundEffects { get; } = GetSupportedBackdrops();

partial void OnThemeChanged(ApplicationTheme value)
{
settingsService.Theme = value;
if (IsOSWindows11OrNewer)
{
ApplicationThemeManager.Apply(settingsService.Theme, settingsService.Background);
return;
}

notificationService.ShowSuccess("Theme changed", "Changes will take effect for new windows");
ApplicationThemeManager.Apply(settingsService.Theme, settingsService.Background);
}

partial void OnBackgroundChanged(WindowBackdropType value)
{
settingsService.Background = value;
window.WindowBackdropType = value;
ApplicationThemeManager.Apply(settingsService.Theme, settingsService.Background);
}

partial void OnUseTransitionChanged(bool value)
Expand Down Expand Up @@ -101,4 +86,21 @@ partial void OnUseModifyTabChanged(bool value)
settingsService.UseModifyTab = value;
RibbonController.ReloadPanels(settingsService);
}

private static List<WindowBackdropType> GetSupportedBackdrops()
{
var backdropTypes = new List<WindowBackdropType>(4);

AddEffect(WindowBackdropType.None);
AddEffect(WindowBackdropType.Acrylic);
AddEffect(WindowBackdropType.Tabbed);
AddEffect(WindowBackdropType.Mica);

return backdropTypes;

void AddEffect(WindowBackdropType backdropType)
{
if (WindowBackdrop.IsSupported(backdropType)) backdropTypes.Add(backdropType);
}
}
}

0 comments on commit d8fa93f

Please sign in to comment.