Cleaning up the solution. Separating Shared.WinRT, Services and Synchronization. Removing synchronization from app. Reducing bundle size by 45mb.
This commit is contained in:
40
Wino.Shared.WinRT/Services/UnderlyingThemeService.cs
Normal file
40
Wino.Shared.WinRT/Services/UnderlyingThemeService.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Windows.UI.ViewManagement;
|
||||
using Wino.Domain.Interfaces;
|
||||
|
||||
|
||||
|
||||
|
||||
#if NET8_0
|
||||
using Microsoft.UI.Xaml;
|
||||
#else
|
||||
using Microsoft.UI.Xaml;
|
||||
#endif
|
||||
|
||||
namespace Wino.Shared.WinRT.Services
|
||||
{
|
||||
public class UnderlyingThemeService : IUnderlyingThemeService
|
||||
{
|
||||
public const string SelectedAppThemeKey = nameof(SelectedAppThemeKey);
|
||||
|
||||
private readonly UISettings uiSettings = new UISettings();
|
||||
private readonly IConfigurationService _configurationService;
|
||||
|
||||
public UnderlyingThemeService(IConfigurationService configurationService)
|
||||
{
|
||||
_configurationService = configurationService;
|
||||
}
|
||||
|
||||
// This should not rely on application window to be present.
|
||||
// Check theme from the settings, rely on UISettings background color if Default.
|
||||
|
||||
public bool IsUnderlyingThemeDark()
|
||||
{
|
||||
var currentTheme = _configurationService.Get(SelectedAppThemeKey, ElementTheme.Default);
|
||||
|
||||
if (currentTheme == ElementTheme.Default)
|
||||
return uiSettings.GetColorValue(UIColorType.Background).ToString() == "#FF000000";
|
||||
else
|
||||
return currentTheme == ElementTheme.Dark;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user