Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Hide SystemThemeHelper methods from IntelliSense #1324

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Uno.Toolkit.UI/Helpers/SystemThemeHelper.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI;
using Windows.UI.ViewManagement;
using System.ComponentModel;

#if IS_WINUI
using Microsoft.UI.Xaml;
Expand Down Expand Up @@ -34,6 +31,7 @@ public static ApplicationTheme GetCurrentOsTheme()
/// <summary>
/// Get the current theme of the application.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also add the attribute to ToggleApplicationTheme method as well, right? Since itself is reference the deprecated methods?

public static ApplicationTheme GetApplicationTheme()
=> GetRootTheme(GetWindowRoot()?.XamlRoot);

Expand All @@ -54,12 +52,14 @@ public static ApplicationTheme GetRootTheme(XamlRoot? root)
/// <summary>
/// Get if the application is currently in dark mode.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm leaning more toward using the ObsoleteAttribute

public static bool IsAppInDarkMode()
=> GetRootTheme(GetWindowRoot().XamlRoot) == ApplicationTheme.Dark;

public static bool IsRootInDarkMode(XamlRoot root)
=> GetRootTheme(root) == ApplicationTheme.Dark;

[EditorBrowsable(EditorBrowsableState.Never)]
public static void SetApplicationTheme(bool darkMode)
=> SetRootTheme(GetWindowRoot().XamlRoot, darkMode);

Expand Down
Loading