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: Mark SystemThemeHelper methods as obsolete #1324

Merged
merged 3 commits into from
Jan 31, 2025
Merged
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
9 changes: 5 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>
[Obsolete("GetApplicationTheme is obsolete. Use GetRootTheme(XamlRoot root) instead.")]
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>
[Obsolete("IsAppInDarkMode is obsolete. Use IsRootInDarkMode(XamlRoot root) instead.")]
public static bool IsAppInDarkMode()
=> GetRootTheme(GetWindowRoot().XamlRoot) == ApplicationTheme.Dark;

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

[Obsolete("SetApplicationTheme(bool darkMode) is obsolete. Use SetApplicationTheme(XamlRoot? root, ElementTheme theme) instead.")]
public static void SetApplicationTheme(bool darkMode)
=> SetRootTheme(GetWindowRoot().XamlRoot, darkMode);

Expand All @@ -79,6 +79,7 @@ public static void SetApplicationTheme(XamlRoot? root, ElementTheme theme)
}
}

[Obsolete("ToggleApplicationTheme() is obsolete. Use SetApplicationTheme(XamlRoot? root, ElementTheme theme) instead.")]
public static void ToggleApplicationTheme()
=> SetApplicationTheme(darkMode: !IsAppInDarkMode());

Expand Down
Loading