Files
Wino-Mail/Wino.Core.UWP/Models/Personalization/PreDefinedAppTheme.cs

34 lines
1.2 KiB
C#
Raw Normal View History

2024-04-18 01:44:37 +02:00
using System;
using System.Threading.Tasks;
using Windows.Storage;
using Wino.Core.Domain.Enums;
using Wino.Core.Domain.Models.Personalization;
2025-02-16 11:54:23 +01:00
namespace Wino.Core.UWP.Models.Personalization;
/// <summary>
/// Forest, Nighty, Clouds etc. applies to pre-defined themes in Wino.
/// </summary>
public class PreDefinedAppTheme : AppThemeBase
2024-04-18 01:44:37 +02:00
{
2025-02-16 11:54:23 +01:00
public PreDefinedAppTheme(string themeName,
Guid id,
string accentColor = "",
ApplicationElementTheme forcedElementTheme = ApplicationElementTheme.Default) : base(themeName, id)
2024-04-18 01:44:37 +02:00
{
2025-02-16 11:54:23 +01:00
AccentColor = accentColor;
ForceElementTheme = forcedElementTheme;
}
2024-04-18 01:44:37 +02:00
2025-02-16 11:54:23 +01:00
public override AppThemeType AppThemeType => AppThemeType.PreDefined;
2024-04-18 01:44:37 +02:00
2025-02-16 11:54:23 +01:00
public override string GetBackgroundPreviewImagePath()
=> $"ms-appx:///Wino.Core.UWP/BackgroundImages/{ThemeName}.jpg";
2024-04-18 01:44:37 +02:00
2025-02-16 11:54:23 +01:00
public override async Task<string> GetThemeResourceDictionaryContentAsync()
{
var xamlDictionaryFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri($"ms-appx:///Wino.Core.UWP/AppThemes/{ThemeName}.xaml"));
return await FileIO.ReadTextAsync(xamlDictionaryFile);
2024-04-18 01:44:37 +02:00
}
}