2024-04-18 01:44:37 +02:00
|
|
|
|
using Windows.UI.ViewManagement;
|
2024-08-05 00:36:26 +02:00
|
|
|
|
using Wino.Core.Domain.Enums;
|
2024-04-18 01:44:37 +02:00
|
|
|
|
using Wino.Core.Domain.Interfaces;
|
|
|
|
|
|
|
2025-02-16 11:54:23 +01:00
|
|
|
|
namespace Wino.Core.UWP.Services;
|
|
|
|
|
|
|
|
|
|
|
|
public class UnderlyingThemeService : IUnderlyingThemeService
|
2024-04-18 01:44:37 +02:00
|
|
|
|
{
|
2025-02-16 11:54:23 +01:00
|
|
|
|
public const string SelectedAppThemeKey = nameof(SelectedAppThemeKey);
|
2024-04-18 01:44:37 +02:00
|
|
|
|
|
2025-02-16 11:54:23 +01:00
|
|
|
|
private readonly UISettings uiSettings = new UISettings();
|
|
|
|
|
|
private readonly IConfigurationService _configurationService;
|
2024-04-18 01:44:37 +02:00
|
|
|
|
|
2025-02-16 11:54:23 +01:00
|
|
|
|
public UnderlyingThemeService(IConfigurationService configurationService)
|
|
|
|
|
|
{
|
|
|
|
|
|
_configurationService = configurationService;
|
|
|
|
|
|
}
|
2024-04-18 01:44:37 +02:00
|
|
|
|
|
2025-02-16 11:54:23 +01:00
|
|
|
|
public bool IsUnderlyingThemeDark()
|
|
|
|
|
|
{
|
|
|
|
|
|
var currentTheme = _configurationService.Get(SelectedAppThemeKey, ApplicationElementTheme.Default);
|
2024-04-18 01:44:37 +02:00
|
|
|
|
|
2025-02-16 11:54:23 +01:00
|
|
|
|
if (currentTheme == ApplicationElementTheme.Default)
|
|
|
|
|
|
return uiSettings.GetColorValue(UIColorType.Background).ToString() == "#FF000000";
|
|
|
|
|
|
else
|
|
|
|
|
|
return currentTheme == ApplicationElementTheme.Dark;
|
2024-04-18 01:44:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|