change settings store way

This commit is contained in:
Zhe Fang
2025-08-09 12:32:34 -04:00
parent 0593f9aa3f
commit faf8acf669
33 changed files with 377 additions and 1059 deletions

View File

@@ -68,10 +68,10 @@ namespace BetterLyrics.WinUI3.Helper
}
// <20>Ӵ洢<D3B4><E6B4A2><EFBFBD><EFBFBD>ȡĿ<C8A1><C4BF><EFBFBD><EFBFBD><EFBFBD>ߺ<EFBFBD>λ<EFBFBD><CEBB>
int targetWidth = _settingsService.DesktopWindowWidth;
int targetHeight = _settingsService.DesktopWindowHeight;
int targetX = _settingsService.DesktopWindowLeft;
int targetY = _settingsService.DesktopWindowTop;
int targetWidth = _settingsService.AppSettings.DesktopWindowWidth;
int targetHeight = _settingsService.AppSettings.DesktopWindowHeight;
int targetX = _settingsService.AppSettings.DesktopWindowLeft;
int targetY = _settingsService.AppSettings.DesktopWindowTop;
// <20><><EFBFBD>ô<EFBFBD><C3B4>ڴ<EFBFBD>С<EFBFBD><D0A1>λ<EFBFBD><CEBB>
window.AppWindow.MoveAndResize(

View File

@@ -78,7 +78,7 @@ namespace BetterLyrics.WinUI3.Helper
RegisterAppBar(hwnd, monitorDeviceName, appBarHeight, dockPlacement);
var monitorInfo = MonitorHelper.GetMonitorInfoExFromDeviceName(_settingsService.DockMonitorDeviceName);
var monitorInfo = MonitorHelper.GetMonitorInfoExFromDeviceName(_settingsService.AppSettings.DockMonitorDeviceName);
int screenWidth = monitorInfo.rcMonitor.Width;
int screenHeight = monitorInfo.rcMonitor.Bottom - monitorInfo.rcMonitor.Top;

View File

@@ -15,6 +15,6 @@ namespace BetterLyrics.WinUI3.Helper
public static string[] SystemFontFamilies => CanvasTextFormat.GetSystemFontFamilies();
public static string GetUserPreferredFontFamily() => SystemFontFamilies.ElementAtOrDefault(_settingsService.SelectedFontFamilyIndex) ?? "Segoe UI";
public static string GetUserPreferredFontFamily() => SystemFontFamilies.ElementAtOrDefault(_settingsService.AppSettings.SelectedFontFamilyIndex) ?? "Segoe UI";
}
}

View File

@@ -101,7 +101,7 @@ namespace BetterLyrics.WinUI3.Services
public static string GetUserTargetLanguageCode()
{
return SupportedTargetLanguages[_settingsService.SelectedTargetLanguageIndex].Code;
return SupportedTargetLanguages[_settingsService.AppSettings.SelectedTargetLanguageIndex].Code;
}
public static int GetDefaultTargetLanguageIndex()

View File

@@ -16,6 +16,7 @@ namespace BetterLyrics.WinUI3.Helper
public static string AssetsFolder => Path.Combine(Package.Current.InstalledPath, "Assets");
public static string SettingsDirectory => Path.Combine(LocalFolder, "settings");
public static string SettingsFilePath => Path.Combine(SettingsDirectory, "settings.json");
public static string LanguageProfilePath => Path.Combine(AssetsFolder, "Wiki82.profile.xml");
public static string LogoPath => Path.Combine(AssetsFolder, "Logo.ico");

View File

@@ -0,0 +1,84 @@
using BetterLyrics.WinUI3.Enums;
using BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Services;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.UI;
using Microsoft.UI.Xaml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI;
namespace BetterLyrics.WinUI3.Models
{
public partial class AppSettings : ObservableObject
{
[ObservableProperty] public partial AutoStartWindowType AutoStartWindowType { get; set; } = AutoStartWindowType.StandardMode;
[ObservableProperty] public partial int CoverImageRadius { get; set; } = 12; // 12 % of the cover image size
[ObservableProperty] public partial int CoverOverlayBlurAmount { get; set; } = 100; // 100 % of the cover image size
[ObservableProperty] public partial int CoverOverlayOpacity { get; set; } = 100; // 100 % = 1.0
[ObservableProperty] public partial int CoverOverlaySpeed { get; set; } = 50; // 50 % of the base rotate speed
[ObservableProperty] public partial int CoverAcrylicEffectAmount { get; set; } = 0;
[ObservableProperty] public partial bool IsFanLyricsEnabled { get; set; } = false;
[ObservableProperty] public partial bool IsLyricsGlowEffectEnabled { get; set; } = true;
[ObservableProperty] public partial Language Language { get; set; } = Language.FollowSystem;
[ObservableProperty] public partial int DesktopWindowLeft { get; set; } = 100;
[ObservableProperty] public partial int DesktopWindowTop { get; set; } = 100;
[ObservableProperty] public partial int DesktopWindowWidth { get; set; } = 400;
[ObservableProperty] public partial int DesktopWindowHeight { get; set; } = 200;
[ObservableProperty] public partial int StandardWindowWidth { get; set; } = 1000;
[ObservableProperty] public partial int StandardWindowHeight { get; set; } = 600;
[ObservableProperty] public partial int StandardWindowLeft { get; set; } = 100;
[ObservableProperty] public partial int StandardWindowTop { get; set; } = 100;
[ObservableProperty] public partial bool AutoLockOnDesktopMode { get; set; } = false;
[ObservableProperty] public partial string LibreTranslateServer { get; set; } = string.Empty;
[ObservableProperty] public partial int SelectedTargetLanguageIndex { get; set; } = LanguageHelper.GetDefaultTargetLanguageIndex();
[ObservableProperty] public partial List<LocalMediaFolder> LocalMediaFolders { get; set; } = [];
[ObservableProperty] public partial TextAlignmentType LyricsAlignmentType { get; set; } = TextAlignmentType.Left;
[ObservableProperty] public partial TextAlignmentType SongInfoAlignmentType { get; set; } = TextAlignmentType.Left;
[ObservableProperty] public partial int LyricsBlurAmount { get; set; } = 5;
[ObservableProperty] public partial Color LyricsCustomBgFontColor { get; set; } = Colors.White;
[ObservableProperty] public partial Color LyricsCustomFgFontColor { get; set; } = Colors.White;
[ObservableProperty] public partial Color LyricsCustomStrokeFontColor { get; set; } = Colors.White;
[ObservableProperty] public partial int LyricsBgFontOpacity { get; set; } = 30; // 30% opacity
[ObservableProperty] public partial LyricsFontColorType LyricsBgFontColorType { get; set; } = LyricsFontColorType.AdaptiveGrayed;
[ObservableProperty] public partial LyricsFontColorType LyricsFgFontColorType { get; set; } = LyricsFontColorType.AdaptiveGrayed;
[ObservableProperty] public partial LyricsFontColorType LyricsStrokeFontColorType { get; set; } = LyricsFontColorType.AdaptiveGrayed;
[ObservableProperty] public partial int LyricsStandardFontSize { get; set; } = 32;
[ObservableProperty] public partial int LyricsDockFontSize { get; set; } = 16;
[ObservableProperty] public partial int LyricsDesktopFontSize { get; set; } = 28;
[ObservableProperty] public partial ElementTheme LyricsBackgroundTheme { get; set; } = ElementTheme.Dark;
[ObservableProperty] public partial int LyricsFontStrokeWidth { get; set; } = 2;
[ObservableProperty] public partial LyricsFontWeight LyricsFontWeight { get; set; } = LyricsFontWeight.Bold;
[ObservableProperty] public partial LineRenderingType LyricsGlowEffectScope { get; set; } = LineRenderingType.CurrentChar;
[ObservableProperty] public partial LineRenderingType LyricsHighlightScope { get; set; } = LineRenderingType.LineStartToCurrentChar;
[ObservableProperty] public partial bool IsLyricsFloatAnimationEnabled { get; set; } = true;
[ObservableProperty] public partial double LyricsLineSpacingFactor { get; set; } = 0.5;
[ObservableProperty] public partial List<MediaSourceProviderInfo> MediaSourceProvidersInfo { get; set; } = [];
[ObservableProperty] public partial EasingType LyricsScrollEasingType { get; set; } = EasingType.EaseInOutSine;
[ObservableProperty] public partial int LyricsScrollDuration { get; set; } = 500; // 500 ms
[ObservableProperty] public partial int LyricsScrollTopDuration { get; set; } = 100; // 100 ms
[ObservableProperty] public partial int LyricsScrollBottomDuration { get; set; } = 1000; // 1000 ms
[ObservableProperty] public partial int LyricsVerticalEdgeOpacity { get; set; } = 0; // 0% opacity
[ObservableProperty] public partial bool IgnoreFullscreenWindow { get; set; } = false;
[ObservableProperty] public partial bool IsTranslationEnabled { get; set; } = true;
[ObservableProperty] public partial bool ShowTranslationOnly { get; set; } = false;
[ObservableProperty] public partial LyricsDisplayType DisplayType { get; set; } = LyricsDisplayType.SplitView;
[ObservableProperty] public partial int LockHotKeyIndex { get; set; } = 'U' - 'A'; // Default to 'U' key
[ObservableProperty] public partial bool IsImmersiveMode { get; set; } = false;
[ObservableProperty] public partial string LXMusicServer { get; set; } = string.Empty;
[ObservableProperty] public partial DockPlacement DockPlacement { get; set; } = DockPlacement.Top;
[ObservableProperty] public partial bool HideWindowWhenNotPlaying { get; set; } = true;
[ObservableProperty] public partial int DockWindowHeight { get; set; } = 64;
[ObservableProperty] public partial int SelectedFontFamilyIndex { get; set; } = 0;
[ObservableProperty] public partial string LyricsFontFamily { get; set; } = FontHelper.SystemFontFamilies.FirstOrDefault() ?? "";
[ObservableProperty] public partial bool IsDragEverywhereEnabled { get; set; } = false;
[ObservableProperty] public partial PlaybackOrder PlaybackOrder { get; set; } = PlaybackOrder.RepeatAll;
[ObservableProperty] public partial bool IsLibreTranslateEnabled { get; set; } = false;
[ObservableProperty] public partial string DockMonitorDeviceName { get; set; } = MonitorHelper.GetPrimaryMonitorDeviceName();
[ObservableProperty] public partial string LastFMSessionKey { get; set; } = string.Empty;
[ObservableProperty] public partial string LyricsTranslationSeparator { get; set; } = StringHelper.NewLine;
}
}

View File

@@ -1,22 +1,15 @@
// 2025/6/23 by Zhe Fang
using BetterLyrics.WinUI3.Models;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
using BetterLyrics.WinUI3.Models;
namespace BetterLyrics.WinUI3.Serialization
{
[JsonSerializable(typeof(List<AlbumArtSearchProviderInfo>))]
[JsonSerializable(typeof(List<LyricsSearchProviderInfo>))]
[JsonSerializable(typeof(List<MediaSourceProviderInfo>))]
[JsonSerializable(typeof(List<LocalMediaFolder>))]
[JsonSerializable(typeof(List<string>))]
[JsonSerializable(typeof(Dictionary<string, object>))]
[JsonSerializable(typeof(TranslateResponse))]
[JsonSerializable(typeof(JsonElement))]
[JsonSerializable(typeof(double))]
[JsonSerializable(typeof(AppSettings))]
[JsonSourceGenerationOptions(WriteIndented = true)]
internal partial class SourceGenerationContext : JsonSerializerContext { }
}

View File

@@ -36,7 +36,7 @@ namespace BetterLyrics.WinUI3.Services.AlbumArtSearchService
{
byte[]? result = null;
foreach (var provider in _settingsService.MediaSourceProvidersInfo.Where(x => x.Provider == mediaSessionId).FirstOrDefault()?.AlbumArtSearchProvidersInfo ?? [])
foreach (var provider in _settingsService.AppSettings.MediaSourceProvidersInfo.Where(x => x.Provider == mediaSessionId).FirstOrDefault()?.AlbumArtSearchProvidersInfo ?? [])
{
if (!provider.IsEnabled)
{
@@ -69,7 +69,7 @@ namespace BetterLyrics.WinUI3.Services.AlbumArtSearchService
private byte[]? SearchFile(string artist, string title)
{
foreach (var folder in _settingsService.LocalMediaFolders)
foreach (var folder in _settingsService.AppSettings.LocalMediaFolders)
{
if (Directory.Exists(folder.Path) && folder.IsEnabled)
{

View File

@@ -40,7 +40,7 @@ namespace BetterLyrics.WinUI3.Services.LastFMService
_settingsService = settingsService;
_client = new LastfmClient(Constants.LastFM.ApiKey, Constants.LastFM.SharedSecret);
_client.Session.SessionKey = _settingsService.LastFMSessionKey;
_client.Session.SessionKey = _settingsService.AppSettings.LastFMSessionKey;
UpdateAuthStatusAsync();
}
@@ -49,7 +49,7 @@ namespace BetterLyrics.WinUI3.Services.LastFMService
try
{
await _client.AuthenticateViaWebAsync();
_settingsService.LastFMSessionKey = _client.Session.SessionKey;
_settingsService.AppSettings.LastFMSessionKey = _client.Session.SessionKey;
await UpdateAuthStatusAsync();
}
catch (Exception)
@@ -61,7 +61,7 @@ namespace BetterLyrics.WinUI3.Services.LastFMService
public async Task ConfirmUnAuthAsync()
{
_client.Session.SessionKey = "";
_settingsService.LastFMSessionKey = "";
_settingsService.AppSettings.LastFMSessionKey = "";
await UpdateAuthStatusAsync();
}

View File

@@ -18,7 +18,7 @@ namespace BetterLyrics.WinUI3.Services.LibWatcherService
public LibWatcherService(ISettingsService settingsService) : base(settingsService)
{
UpdateWatchers(_settingsService.LocalMediaFolders);
UpdateWatchers(_settingsService.AppSettings.LocalMediaFolders);
}
public event EventHandler<LibChangedEventArgs>? MusicLibraryFilesChanged;

View File

@@ -92,7 +92,7 @@ namespace BetterLyrics.WinUI3.Services.LyricsSearchService
try
{
foreach (var provider in _settingsService.MediaSourceProvidersInfo.Where(x => x.Provider == mediaSessionId).FirstOrDefault()?.LyricsSearchProvidersInfo ?? [])
foreach (var provider in _settingsService.AppSettings.MediaSourceProvidersInfo.Where(x => x.Provider == mediaSessionId).FirstOrDefault()?.LyricsSearchProvidersInfo ?? [])
{
if (!provider.IsEnabled)
{
@@ -169,7 +169,7 @@ namespace BetterLyrics.WinUI3.Services.LyricsSearchService
private async Task<string?> SearchFile(string title, string artist, LyricsFormat format)
{
foreach (var folder in _settingsService.LocalMediaFolders)
foreach (var folder in _settingsService.AppSettings.LocalMediaFolders)
{
if (Directory.Exists(folder.Path) && folder.IsEnabled)
{
@@ -191,7 +191,7 @@ namespace BetterLyrics.WinUI3.Services.LyricsSearchService
private string? SearchEmbedded(string title, string artist)
{
foreach (var folder in _settingsService.LocalMediaFolders)
foreach (var folder in _settingsService.AppSettings.LocalMediaFolders)
{
if (Directory.Exists(folder.Path) && folder.IsEnabled)
{

View File

@@ -68,7 +68,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
_albumArtSearchService = albumArtSearchService;
_logger = Ioc.Default.GetRequiredService<ILogger<MediaSessionsService>>();
_mediaSourceProvidersInfo = _settingsService.MediaSourceProvidersInfo;
_mediaSourceProvidersInfo = _settingsService.AppSettings.MediaSourceProvidersInfo;
InitMediaManager();
}
@@ -288,7 +288,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
_mediaSourceProvidersInfo.Add(new MediaSourceProviderInfo(id));
// 在这里就写进设置
// 因为 SettingsPageViewModel 可能还没有初始化
_settingsService.MediaSourceProvidersInfo = _mediaSourceProvidersInfo;
_settingsService.AppSettings.MediaSourceProvidersInfo = _mediaSourceProvidersInfo;
_dispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, () =>
{
MediaSourceProvidersInfoChanged?.Invoke(this, new MediaSourceProvidersInfoEventArgs(_mediaSourceProvidersInfo));
@@ -368,7 +368,7 @@ namespace BetterLyrics.WinUI3.Services.MediaSessionsService
{
try
{
_sse = new EventSourceReader(new Uri($"{_settingsService.LXMusicServer}{Constants.LXMusic.QuerySuffix}")).Start();
_sse = new EventSourceReader(new Uri($"{_settingsService.AppSettings.LXMusicServer}{Constants.LXMusic.QuerySuffix}")).Start();
_sse.MessageReceived += Sse_MessageReceived;
_sse.Disconnected += Sse_Disconnected;
}

View File

@@ -10,107 +10,9 @@ namespace BetterLyrics.WinUI3.Services.SettingsService
{
public interface ISettingsService
{
AppSettings AppSettings { get; set; }
// App behavior
AutoStartWindowType AutoStartWindowType { get; set; }
int CoverImageRadius { get; set; }
int CoverOverlayBlurAmount { get; set; }
int CoverOverlayOpacity { get; set; }
int CoverOverlaySpeed { get; set; }
int CoverAcrylicEffectAmount { get; set; }
bool IsFanLyricsEnabled { get; set; }
bool IsFirstRun { get; set; }
bool IsLyricsGlowEffectEnabled { get; set; }
Language Language { get; set; }
int DesktopWindowLeft { get; set; }
int DesktopWindowTop { get; set; }
int DesktopWindowWidth { get; set; }
int DesktopWindowHeight { get; set; }
int StandardWindowWidth { get; set; }
int StandardWindowHeight { get; set; }
int StandardWindowLeft { get; set; }
int StandardWindowTop { get; set; }
bool AutoLockOnDesktopMode { get; set; }
string LibreTranslateServer { get; set; }
int SelectedTargetLanguageIndex { get; set; }
int PositionOffset { get; set; }
// Lyrics lib
List<LocalMediaFolder> LocalMediaFolders { get; set; }
// Lyrics style and effetc
TextAlignmentType LyricsAlignmentType { get; set; }
TextAlignmentType SongInfoAlignmentType { get; set; }
int LyricsBlurAmount { get; set; }
Color LyricsCustomBgFontColor { get; set; }
Color LyricsCustomFgFontColor { get; set; }
Color LyricsCustomStrokeFontColor { get; set; }
int LyricsBgFontOpacity { get; set; }
LyricsFontColorType LyricsBgFontColorType { get; set; }
LyricsFontColorType LyricsFgFontColorType { get; set; }
LyricsFontColorType LyricsStrokeFontColorType { get; set; }
int LyricsStandardFontSize { get; set; }
int LyricsDockFontSize { get; set; }
int LyricsDesktopFontSize { get; set; }
ElementTheme LyricsBackgroundTheme { get; set; }
int LyricsFontStrokeWidth { get; set; }
LyricsFontWeight LyricsFontWeight { get; set; }
LineRenderingType LyricsGlowEffectScope { get; set; }
LineRenderingType LyricsHighlightScope { get; set; }
bool IsLyricsFloatAnimationEnabled { get; set; }
double LyricsLineSpacingFactor { get; set; }
List<MediaSourceProviderInfo> MediaSourceProvidersInfo { get; set; }
EasingType LyricsScrollEasingType { get; set; }
int LyricsScrollDuration { get; set; }
int LyricsScrollTopDuration { get; set; }
int LyricsScrollBottomDuration { get; set; }
int LyricsVerticalEdgeOpacity { get; set; }
bool IgnoreFullscreenWindow { get; set; }
bool IsTranslationEnabled { get; set; }
bool ShowTranslationOnly { get; set; }
LyricsDisplayType DisplayType { get; set; }
int LockHotKeyIndex { get; set; }
bool IsImmersiveMode { get; set; }
string LXMusicServer { get; set; }
DockPlacement DockPlacement { get; set; }
bool HideWindowWhenNotPlaying { get; set; }
int DockWindowHeight { get; set; }
int SelectedFontFamilyIndex { get; set; }
string LyricsFontFamily { get; set; }
bool IsDragEverywhereEnabled { get; set; }
PlaybackOrder PlaybackOrder { get; set; }
bool IsLibreTranslateEnabled { get; set; }
string DockMonitorDeviceName { get; set; }
// LastFM
string LastFMSessionKey { get; set; }
string LyricsTranslationSeparator { get; set; }
bool ImportSettings(string importPath);
void ExportSettings(string exportPath);
}

View File

@@ -4,134 +4,35 @@ using BetterLyrics.WinUI3.Enums;
using BetterLyrics.WinUI3.Helper;
using BetterLyrics.WinUI3.Models;
using BetterLyrics.WinUI3.Serialization;
using CommunityToolkit.WinUI.Helpers;
using Microsoft.UI;
using Microsoft.UI.Xaml;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.WinUI;
using Microsoft.UI.Dispatching;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.Json.Serialization.Metadata;
using Windows.Media.Core;
using Windows.Storage;
using Windows.UI;
namespace BetterLyrics.WinUI3.Services.SettingsService
{
public class SettingsService : ISettingsService
// TODO 初始化时从文件读取到对象,后续独写操作先操纵对象,写入用 Debounce 写入文件
// 新建一个 AppSettings 类
public partial class SettingsService : ObservableObject, ISettingsService
{
public const string LyricsCustomBgFontColorKey = "LyricsCustomBgFontColor";
public const string LyricsCustomFgFontColorKey = "LyricsCustomFgFontColor";
public const string LyricsCustomStrokeFontColorKey = "LyricsCustomStrokeFontColor";
private readonly DispatcherQueue _dispatcherQueue;
private readonly DispatcherQueueTimer _dispatcherQueueTimer;
// App behavior
private const string AutoStartWindowTypeKey = "AutoStartWindowType";
private const string CoverImageRadiusKey = "AlbumArtCornerRadius";
private const string CoverOverlayBlurAmountKey = "CoverOverlayBlurAmount";
private const string CoverOverlayOpacityKey = "CoverOverlayOpacity";
private const string CoverOverlaySpeedKey = "CoverOverlaySpeed";
private const string IsCoverOverlayEnabledKey = "IsCoverOverlayEnabled";
private const string CoverAcrylicEffectAmountKey = "CoverAcrylicEffectAmount";
private const string DesktopWindowLeftKey = "DesktopWindowLeft";
private const string DesktopWindowTopKey = "DesktopWindowTop";
private const string DesktopWindowWidthKey = "DesktopWindowWidth";
private const string DesktopWindowHeightKey = "DesktopWindowHeight";
private const string StandardWindowLeftKey = "StandardWindowLeft";
private const string StandardWindowTopKey = "StandardWindowTop";
private const string StandardWindowWidthKey = "StandardWindowWidth";
private const string StandardWindowHeightKey = "StandardWindowHeight";
private const string AutoLockOnDesktopModeKey = "AutoLockOnDesktopMode";
private const string IsImmersiveModeKey = "IsImmersiveMode";
private const string IsFanLyricsEnabledKey = "IsFanLyricsEnabled";
private const string IsFirstRunKey = "IsFirstRun";
private const string IsLyricsGlowEffectEnabledKey = "IsLyricsGlowEffectEnabled";
private const string LanguageKey = "Language";
private const string LocalMediaFoldersKey = "LocalLyricsFolders.json";
private const string LyricsAlignmentTypeKey = "TextAlignmentType";
private const string SongInfoAlignmentTypeKey = "SongInfoAlignmentType";
private const string LyricsBlurAmountKey = "LyricsBlurAmount";
private const string LyricsBgFontColorTypeKey = "_lyricsBgFontColorType";
private const string LyricsFgFontColorTypeKey = "LyricsFgFontColorType";
private const string LyricsStrokeFontColorTypeKey = "LyricsStrokeFontColorType";
private const string LyricsFontStrokeWidthKey = "LyricsFontStrokeWidth";
// Lyrics font size
private const string LyricsStandardFontSizeKey = "LyricsStandardFontSize";
private const string LyricsDockFontSizeKey = "LyricsDockFontSize";
private const string LyricsDesktopFontSizeKey = "LyricsDesktopFontSize";
private const string LyricsFontWeightKey = "LyricsFontWeightKey";
private const string LyricsGlowEffectScopeKey = "LyricsGlowEffectScope";
private const string LyricsHighlightSopeKey = "LyricsHighlightSope";
private const string LyricsLineSpacingFactorKey = "LyricsLineSpacingFactor";
private const string LyricsVerticalEdgeOpacityKey = "LyricsVerticalEdgeOpacity";
private const string MediaSourceProvidersInfoKey = "MediaSourceProvidersInfo.json";
// Translation
private const string IsTranslationEnabledKey = "IsTranslationEnabled";
private const string ShowTranslationOnlyKey = "ShowTranslationOnly";
private const string IsLibreTranslateEnabledKey = "IsLibreTranslateEnabled";
private const string LibreTranslateServerKey = "LibreTranslateServer";
private const string SelectedTargetLanguageIndexKey = "SelectedTargetLanguageIndex";
// LX Music
private const string LXMusicServerKey = "LXMusicServer";
private const string LyricsBackgroundThemeKey = "LyricsBackgroundTheme";
private const string IgnoreFullscreenWindowKey = "IgnoreFullscreenWindow";
private const string PreferredDisplayTypeKey = "PreferredDisplayTypeKey";
private const string LyricsScrollEasingTypeKey = "LyricsScrollEasingType";
private const string LyricsScrollDurationKey = "LyricsScrollDuration";
private const string LyricsScrollTopDurationKey = "LyricsScrollTopDuration";
private const string LyricsScrollBottomDurationKey = "LyricsScrollBottomDuration";
private const string IsLyricsFloatAnimationEnabledKey = "IsLyricsFloatAnimationEnabled";
private const string PlaybackOrderKey = "PlaybackOrder";
private const string PositionOffsetKey = "PositionOffset";
private const string LockHotKeyIndexKey = "LockHotKeyIndex";
private const string DockPlacementKey = "DockPlacement";
private const string LyricsBgFontOpacityKey = "LyricsBgFontOpacity";
private const string HideWindowWhenNotPlayingKey = "HideWindowWhenNotPlaying";
private const string DockWindowHeightKey = "DockWindowHeight";
private const string SelectedFontFamilyIndexKey = "SelectedFontFamilyIndex";
private const string LyricsFontFamilyKey = "LyricsFontFamily";
private const string IsDragEverywhereEnabledKey = "IsDragEverywhereEnabled";
private const string DockMonitorDeviceNameKey = "DockMonitorDeviceName";
// LastFM
private const string LastFMSessionKeyKey = "LastFMSessionKey";
private const string LyricsTranslationSeparatorKey = "LyricsTranslationSeparator";
private readonly ApplicationDataContainer _localSettings;
[ObservableProperty]
public partial AppSettings AppSettings { get; set; }
public SettingsService()
{
_localSettings = ApplicationData.Current.LocalSettings;
_dispatcherQueue = DispatcherQueue.GetForCurrentThread();
_dispatcherQueueTimer = _dispatcherQueue.CreateTimer();
SetDefault(IsFirstRunKey, true);
AppSettings = ReadAppSettings();
AppSettings.PropertyChanged += AppSettings_PropertyChanged;
SetDefault(LocalMediaFoldersKey, [], SourceGenerationContext.Default.ListLocalMediaFolder);
SetDefault(MediaSourceProvidersInfoKey, [], SourceGenerationContext.Default.ListMediaSourceProviderInfo);
MediaSourceProvidersInfo = MediaSourceProvidersInfo.Select(x => new MediaSourceProviderInfo()
// 确保当 LyricsSearchProvider 和 AlbumArtSearchProvider 枚举更新时AppSettings 中的相关信息也能更新
AppSettings.MediaSourceProvidersInfo = AppSettings.MediaSourceProvidersInfo.Select(x => new MediaSourceProviderInfo()
{
IsEnabled = x.IsEnabled,
Provider = x.Provider,
@@ -148,559 +49,11 @@ namespace BetterLyrics.WinUI3.Services.SettingsService
x.AlbumArtSearchProvidersInfo.Where(x => x.Provider == p).FirstOrDefault()?.IsEnabled ?? true
))],
}).ToList();
// App appearance
SetDefault(LanguageKey, (int)Language.FollowSystem);
SetDefault(DesktopWindowHeightKey, 600);
SetDefault(DesktopWindowLeftKey, 200);
SetDefault(DesktopWindowTopKey, 200);
SetDefault(DesktopWindowWidthKey, 1200);
SetDefault(StandardWindowHeightKey, 800);
SetDefault(StandardWindowLeftKey, 200);
SetDefault(StandardWindowTopKey, 200);
SetDefault(StandardWindowWidthKey, 1600);
SetDefault(AutoLockOnDesktopModeKey, false);
SetDefault(IsImmersiveModeKey, false);
// App behavior
SetDefault(AutoStartWindowTypeKey, (int)AutoStartWindowType.StandardMode);
// Album art
SetDefault(IsCoverOverlayEnabledKey, true);
SetDefault(CoverOverlaySpeedKey, 100); // 100 %
SetDefault(CoverOverlayOpacityKey, 100); // 100 % = 1.0
SetDefault(CoverOverlayBlurAmountKey, 100);
SetDefault(CoverImageRadiusKey, 12); // 12 %
SetDefault(CoverAcrylicEffectAmountKey, 0);
// Lyrics
SetDefault(LyricsAlignmentTypeKey, (int)TextAlignmentType.Left);
SetDefault(SongInfoAlignmentTypeKey, (int)TextAlignmentType.Left);
SetDefault(LyricsFontWeightKey, (int)LyricsFontWeight.Bold);
SetDefault(LyricsBlurAmountKey, 5);
SetDefault(LyricsBackgroundThemeKey, (int)ElementTheme.Dark);
SetDefault(LyricsBgFontColorTypeKey, (int)LyricsFontColorType.AdaptiveGrayed);
SetDefault(LyricsFgFontColorTypeKey, (int)LyricsFontColorType.AdaptiveGrayed);
SetDefault(LyricsStrokeFontColorTypeKey, (int)LyricsFontColorType.AdaptiveGrayed);
SetDefault(LyricsCustomBgFontColorKey, Colors.White.ToInt());
SetDefault(LyricsCustomFgFontColorKey, Colors.White.ToInt());
SetDefault(LyricsCustomStrokeFontColorKey, Colors.White.ToInt());
SetDefault(LyricsStandardFontSizeKey, 32);
SetDefault(LyricsDockFontSizeKey, 16);
SetDefault(LyricsDesktopFontSizeKey, 28);
SetDefault(LyricsLineSpacingFactorKey, 0.5f);
SetDefault(LyricsVerticalEdgeOpacityKey, 0);
SetDefault(IsLyricsGlowEffectEnabledKey, true);
SetDefault(LyricsGlowEffectScopeKey, (int)LineRenderingType.CurrentChar);
SetDefault(LyricsHighlightSopeKey, (int)LineRenderingType.LineStartToCurrentChar);
SetDefault(IsFanLyricsEnabledKey, false);
SetDefault(LibreTranslateServerKey, "");
SetDefault(IsLibreTranslateEnabledKey, false);
SetDefault(IsTranslationEnabledKey, true);
SetDefault(ShowTranslationOnlyKey, false);
SetDefault(SelectedTargetLanguageIndexKey, LanguageHelper.GetDefaultTargetLanguageIndex());
SetDefault(LXMusicServerKey, "");
SetDefault(LyricsFontStrokeWidthKey, 3);
SetDefault(IgnoreFullscreenWindowKey, false);
SetDefault(PreferredDisplayTypeKey, (int)LyricsDisplayType.SplitView);
SetDefault(LyricsScrollEasingTypeKey, (int)EasingType.EaseInOutSine);
SetDefault(LyricsScrollTopDurationKey, 100); // ms
SetDefault(LyricsScrollDurationKey, 500); // ms
SetDefault(LyricsScrollBottomDurationKey, 1000); // ms
SetDefault(IsLyricsFloatAnimationEnabledKey, true);
SetDefault(PositionOffsetKey, 0);
SetDefault(LockHotKeyIndexKey, 'U' - 'A');
SetDefault(DockPlacementKey, (int)DockPlacement.Top);
SetDefault(LyricsBgFontOpacityKey, 30); // 30%
SetDefault(HideWindowWhenNotPlayingKey, false);
SetDefault(DockWindowHeightKey, 64); // 64px
SetDefault(SelectedFontFamilyIndexKey, 0);
SetDefault(LyricsFontFamilyKey, FontHelper.SystemFontFamilies.ElementAtOrDefault(0));
SetDefault(IsDragEverywhereEnabledKey, false);
SetDefault(DockMonitorDeviceNameKey, MonitorHelper.GetPrimaryMonitorDeviceName());
SetDefault(LastFMSessionKeyKey, "");
SetDefault(LyricsTranslationSeparatorKey, StringHelper.NewLine);
}
public bool IsDragEverywhereEnabled
{
get => GetValue<bool>(IsDragEverywhereEnabledKey);
set => SetValue(IsDragEverywhereEnabledKey, value);
}
public string LyricsFontFamily
{
get => GetValue<string>(LyricsFontFamilyKey)!;
set => SetValue(LyricsFontFamilyKey, value);
}
public int SelectedFontFamilyIndex
{
get => GetValue<int>(SelectedFontFamilyIndexKey);
set => SetValue(SelectedFontFamilyIndexKey, value);
}
public bool HideWindowWhenNotPlaying
{
get => GetValue<bool>(HideWindowWhenNotPlayingKey);
set => SetValue(HideWindowWhenNotPlayingKey, value);
}
public int DockWindowHeight
{
get => GetValue<int>(DockWindowHeightKey);
set => SetValue(DockWindowHeightKey, value);
}
public int LyricsBgFontOpacity
{
get => GetValue<int>(LyricsBgFontOpacityKey);
set => SetValue(LyricsBgFontOpacityKey, value);
}
public bool ShowTranslationOnly
{
get => GetValue<bool>(ShowTranslationOnlyKey);
set => SetValue(ShowTranslationOnlyKey, value);
}
public DockPlacement DockPlacement
{
get => (DockPlacement)GetValue<int>(DockPlacementKey);
set => SetValue(DockPlacementKey, (int)value);
}
public int LockHotKeyIndex
{
get => GetValue<int>(LockHotKeyIndexKey);
set => SetValue(LockHotKeyIndexKey, value);
}
public EasingType LyricsScrollEasingType
{
get => (EasingType)GetValue<int>(LyricsScrollEasingTypeKey);
set => SetValue(LyricsScrollEasingTypeKey, (int)value);
}
public int LyricsScrollDuration
{
get => GetValue<int>(LyricsScrollDurationKey);
set => SetValue(LyricsScrollDurationKey, value);
}
public int LyricsScrollTopDuration
{
get => GetValue<int>(LyricsScrollTopDurationKey);
set => SetValue(LyricsScrollTopDurationKey, value);
}
public int LyricsScrollBottomDuration
{
get => GetValue<int>(LyricsScrollBottomDurationKey);
set => SetValue(LyricsScrollBottomDurationKey, value);
}
public LyricsDisplayType DisplayType
{
get => (LyricsDisplayType)GetValue<int>(PreferredDisplayTypeKey);
set => SetValue(PreferredDisplayTypeKey, (int)value);
}
public ElementTheme LyricsBackgroundTheme
{
get => (ElementTheme)GetValue<int>(LyricsBackgroundThemeKey);
set => SetValue(LyricsBackgroundThemeKey, (int)value);
}
public AutoStartWindowType AutoStartWindowType
{
get => (AutoStartWindowType)GetValue<int>(AutoStartWindowTypeKey);
set => SetValue(AutoStartWindowTypeKey, (int)value);
}
public int DesktopWindowLeft
{
get => GetValue<int>(DesktopWindowLeftKey);
set => SetValue(DesktopWindowLeftKey, value);
}
public int DesktopWindowTop
{
get => GetValue<int>(DesktopWindowTopKey);
set => SetValue(DesktopWindowTopKey, value);
}
public int DesktopWindowWidth
{
get => GetValue<int>(DesktopWindowWidthKey);
set => SetValue(DesktopWindowWidthKey, value);
}
public int DesktopWindowHeight
{
get => GetValue<int>(DesktopWindowHeightKey);
set => SetValue(DesktopWindowHeightKey, value);
}
public int StandardWindowLeft
{
get => GetValue<int>(StandardWindowLeftKey);
set => SetValue(StandardWindowLeftKey, value);
}
public int StandardWindowTop
{
get => GetValue<int>(StandardWindowTopKey);
set => SetValue(StandardWindowTopKey, value);
}
public int StandardWindowWidth
{
get => GetValue<int>(StandardWindowWidthKey);
set => SetValue(StandardWindowWidthKey, value);
}
public int StandardWindowHeight
{
get => GetValue<int>(StandardWindowHeightKey);
set => SetValue(StandardWindowHeightKey, value);
}
public bool AutoLockOnDesktopMode
{
get => GetValue<bool>(AutoLockOnDesktopModeKey);
set => SetValue(AutoLockOnDesktopModeKey, value);
}
public int CoverImageRadius
{
get => GetValue<int>(CoverImageRadiusKey);
set => SetValue(CoverImageRadiusKey, value);
}
public int CoverOverlayBlurAmount
{
get => GetValue<int>(CoverOverlayBlurAmountKey);
set => SetValue(CoverOverlayBlurAmountKey, value);
}
public int CoverOverlayOpacity
{
get => GetValue<int>(CoverOverlayOpacityKey);
set => SetValue(CoverOverlayOpacityKey, value);
}
public int CoverOverlaySpeed
{
get => GetValue<int>(CoverOverlaySpeedKey);
set => SetValue(CoverOverlaySpeedKey, value);
}
public int CoverAcrylicEffectAmount
{
get => GetValue<int>(CoverAcrylicEffectAmountKey);
set => SetValue(CoverAcrylicEffectAmountKey, value);
}
public bool IsFanLyricsEnabled
{
get => GetValue<bool>(IsFanLyricsEnabledKey);
set => SetValue(IsFanLyricsEnabledKey, value);
}
public bool IsFirstRun
{
get => GetValue<bool>(IsFirstRunKey);
set => SetValue(IsFirstRunKey, value);
}
public bool IsLyricsGlowEffectEnabled
{
get => GetValue<bool>(IsLyricsGlowEffectEnabledKey);
set => SetValue(IsLyricsGlowEffectEnabledKey, value);
}
public Language Language
{
get => (Language)GetValue<int>(LanguageKey);
set => SetValue(LanguageKey, (int)value);
}
public List<LocalMediaFolder> LocalMediaFolders
{
get => GetValue(LocalMediaFoldersKey, SourceGenerationContext.Default.ListLocalMediaFolder)!;
set => SetValue(LocalMediaFoldersKey, value, SourceGenerationContext.Default.ListLocalMediaFolder);
}
public TextAlignmentType LyricsAlignmentType
{
get => (TextAlignmentType)GetValue<int>(LyricsAlignmentTypeKey);
set => SetValue(LyricsAlignmentTypeKey, (int)value);
}
public TextAlignmentType SongInfoAlignmentType
{
get => (TextAlignmentType)GetValue<int>(SongInfoAlignmentTypeKey);
set => SetValue(SongInfoAlignmentTypeKey, (int)value);
}
public int LyricsBlurAmount
{
get => GetValue<int>(LyricsBlurAmountKey);
set => SetValue(LyricsBlurAmountKey, value);
}
public Color LyricsCustomBgFontColor
{
get => GetValue<int>(LyricsCustomBgFontColorKey)!.ToColor();
set => SetValue(LyricsCustomBgFontColorKey, value.ToInt());
}
public Color LyricsCustomFgFontColor
{
get => GetValue<int>(LyricsCustomFgFontColorKey)!.ToColor();
set => SetValue(LyricsCustomFgFontColorKey, value.ToInt());
}
public Color LyricsCustomStrokeFontColor
{
get => GetValue<int>(LyricsCustomStrokeFontColorKey)!.ToColor();
set => SetValue(LyricsCustomStrokeFontColorKey, value.ToInt());
}
public LyricsFontColorType LyricsBgFontColorType
{
get => (LyricsFontColorType)GetValue<int>(LyricsBgFontColorTypeKey);
set => SetValue(LyricsBgFontColorTypeKey, (int)value);
}
public LyricsFontColorType LyricsFgFontColorType
{
get => (LyricsFontColorType)GetValue<int>(LyricsFgFontColorTypeKey);
set => SetValue(LyricsFgFontColorTypeKey, (int)value);
}
public LyricsFontColorType LyricsStrokeFontColorType
{
get => (LyricsFontColorType)GetValue<int>(LyricsStrokeFontColorTypeKey);
set => SetValue(LyricsStrokeFontColorTypeKey, (int)value);
}
public int LyricsFontStrokeWidth
{
get => GetValue<int>(LyricsFontStrokeWidthKey);
set => SetValue(LyricsFontStrokeWidthKey, value);
}
public int LyricsStandardFontSize
{
get => GetValue<int>(LyricsStandardFontSizeKey);
set => SetValue(LyricsStandardFontSizeKey, value);
}
public int LyricsDockFontSize
{
get => GetValue<int>(LyricsDockFontSizeKey);
set => SetValue(LyricsDockFontSizeKey, value);
}
public int LyricsDesktopFontSize
{
get => GetValue<int>(LyricsDesktopFontSizeKey);
set => SetValue(LyricsDesktopFontSizeKey, value);
}
public LyricsFontWeight LyricsFontWeight
{
get => (LyricsFontWeight)GetValue<int>(LyricsFontWeightKey);
set => SetValue(LyricsFontWeightKey, (int)value);
}
public LineRenderingType LyricsGlowEffectScope
{
get => (LineRenderingType)GetValue<int>(LyricsGlowEffectScopeKey);
set => SetValue(LyricsGlowEffectScopeKey, (int)value);
}
public LineRenderingType LyricsHighlightScope
{
get => (LineRenderingType)GetValue<int>(LyricsHighlightSopeKey);
set => SetValue(LyricsHighlightSopeKey, (int)value);
}
public double LyricsLineSpacingFactor
{
get => GetValue<double>(LyricsLineSpacingFactorKey);
set => SetValue(LyricsLineSpacingFactorKey, value);
}
public List<MediaSourceProviderInfo> MediaSourceProvidersInfo
{
get => GetValue(MediaSourceProvidersInfoKey, SourceGenerationContext.Default.ListMediaSourceProviderInfo)!;
set => SetValue(MediaSourceProvidersInfoKey, value, SourceGenerationContext.Default.ListMediaSourceProviderInfo);
}
public int LyricsVerticalEdgeOpacity
{
get => GetValue<int>(LyricsVerticalEdgeOpacityKey);
set => SetValue(LyricsVerticalEdgeOpacityKey, value);
}
public string LibreTranslateServer
{
get => GetValue<string>(LibreTranslateServerKey)!;
set => SetValue(LibreTranslateServerKey, value);
}
public bool IsTranslationEnabled
{
get => GetValue<bool>(IsTranslationEnabledKey);
set => SetValue(IsTranslationEnabledKey, value);
}
public bool IsLibreTranslateEnabled
{
get => GetValue<bool>(IsLibreTranslateEnabledKey);
set => SetValue(IsLibreTranslateEnabledKey, value);
}
public int SelectedTargetLanguageIndex
{
get => GetValue<int>(SelectedTargetLanguageIndexKey);
set => SetValue(SelectedTargetLanguageIndexKey, value);
}
public string LXMusicServer
{
get => GetValue<string>(LXMusicServerKey)!;
set => SetValue(LXMusicServerKey, value);
}
public bool IgnoreFullscreenWindow
{
get => GetValue<bool>(IgnoreFullscreenWindowKey);
set => SetValue(IgnoreFullscreenWindowKey, value);
}
public bool IsLyricsFloatAnimationEnabled
{
get => GetValue<bool>(IsLyricsFloatAnimationEnabledKey);
set => SetValue(IsLyricsFloatAnimationEnabledKey, value);
}
public PlaybackOrder PlaybackOrder
{
get => (PlaybackOrder)GetValue<int>(PlaybackOrderKey);
set => SetValue(PlaybackOrderKey, (int)value);
}
public int PositionOffset
{
get => GetValue<int>(PositionOffsetKey);
set => SetValue(PositionOffsetKey, value);
}
public bool IsImmersiveMode
{
get => GetValue<bool>(IsImmersiveModeKey);
set => SetValue(IsImmersiveModeKey, value);
}
public string DockMonitorDeviceName
{
get => GetValue<string>(DockMonitorDeviceNameKey)!;
set => SetValue(DockMonitorDeviceNameKey, value);
}
// LastFM
public string LastFMSessionKey
{
get => GetValue<string>(LastFMSessionKeyKey)!;
set => SetValue(LastFMSessionKeyKey, value);
}
public string LyricsTranslationSeparator
{
get => GetValue<string>(LyricsTranslationSeparatorKey)!;
set => SetValue(LyricsTranslationSeparatorKey, value);
}
/// <summary>
/// Container 方式取出
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <returns></returns>
private T? GetValue<T>(string key)
{
if (_localSettings.Values.TryGetValue(key, out object? value))
{
if (value is float)
{
value = Convert.ToDouble(value);
}
return (T)value;
}
return default;
}
/// <summary>
/// JSON 方式取出
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="jsonTypeInfo"></param>
/// <returns></returns>
private T? GetValue<T>(string key, JsonTypeInfo<T> jsonTypeInfo)
{
string targetPath = Path.Combine(PathHelper.SettingsDirectory, key);
if (File.Exists(targetPath))
{
string json = File.ReadAllText(targetPath);
return System.Text.Json.JsonSerializer.Deserialize<T>(json, jsonTypeInfo);
}
return default;
}
private void SetDefault<T>(string key, T value)
{
if (_localSettings.Values.ContainsKey(key) && _localSettings.Values[key] is T)
return;
SetValue(key, value);
}
private void SetDefault<T>(string key, T value, JsonTypeInfo<T> jsonTypeInfo)
{
string targetPath = Path.Combine(PathHelper.SettingsDirectory, key);
if (File.Exists(targetPath))
return;
SetValue(key, value, jsonTypeInfo);
}
private void SetValue<T>(string key, T value)
{
_localSettings.Values[key] = value;
}
private void SetValue<T>(string key, T value, JsonTypeInfo<T> jsonTypeInfo)
private void AppSettings_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
{
string targetPath = Path.Combine(PathHelper.SettingsDirectory, key);
string json = System.Text.Json.JsonSerializer.Serialize(value, jsonTypeInfo);
File.WriteAllText(targetPath, json);
WriteAppSettingsDebounce();
}
/// <summary>
@@ -709,24 +62,8 @@ namespace BetterLyrics.WinUI3.Services.SettingsService
/// <param name="exportPath">Target folder path (not file path)</param>
public void ExportSettings(string exportPath)
{
// 收集 LocalSettings
var exportData = new Dictionary<string, object>();
foreach (var kvp in _localSettings.Values)
{
exportData[kvp.Key] = kvp.Value;
}
// 收集 SettingsDirectory 下的 JSON 文件
var settingsFiles = Directory.GetFiles(PathHelper.SettingsDirectory, "*.json");
foreach (var file in settingsFiles)
{
var key = Path.GetFileName(file);
var json = File.ReadAllText(file);
exportData[key] = json;
}
// 导出到文件
var exportJson = System.Text.Json.JsonSerializer.Serialize(exportData, SourceGenerationContext.Default.DictionaryStringObject);
var exportJson = System.Text.Json.JsonSerializer.Serialize(AppSettings, SourceGenerationContext.Default.AppSettings);
File.WriteAllText(Path.Combine(exportPath, $"BetterLyrics_Settings_Export_{DateTime.Now:yyyyMMdd_HHmmss}.json"), exportJson);
}
@@ -742,28 +79,42 @@ namespace BetterLyrics.WinUI3.Services.SettingsService
return false;
var importJson = File.ReadAllText(importPath);
var importData = System.Text.Json.JsonSerializer.Deserialize(importJson, SourceGenerationContext.Default.DictionaryStringObject);
var importData = System.Text.Json.JsonSerializer.Deserialize(importJson, SourceGenerationContext.Default.AppSettings);
if (importData == null)
return false;
foreach (var kvp in importData)
{
// 如果是 JSON 文件,则写入 SettingsDirectory
if (kvp.Key.EndsWith(".json"))
{
var filePath = Path.Combine(PathHelper.SettingsDirectory, kvp.Key);
File.WriteAllText(filePath, kvp.Value?.ToString() ?? "");
}
else
{
// 其他设置写入 LocalSettings
SetValue(kvp.Key, kvp.Value);
}
return true;
}
AppSettings = importData;
SaveAppSettings();
return true;
}
private static AppSettings ReadAppSettings()
{
if (!File.Exists(PathHelper.SettingsFilePath))
return new AppSettings();
var json = File.ReadAllText(PathHelper.SettingsFilePath);
var data = System.Text.Json.JsonSerializer.Deserialize(json, SourceGenerationContext.Default.AppSettings);
if (data == null)
return new AppSettings();
return data;
}
private void WriteAppSettingsDebounce()
{
_dispatcherQueueTimer.Debounce(() =>
{
SaveAppSettings();
}, Constants.Time.DebounceTimeout);
}
private void SaveAppSettings()
{
File.WriteAllText(PathHelper.SettingsFilePath, System.Text.Json.JsonSerializer.Serialize(AppSettings, SourceGenerationContext.Default.AppSettings));
}
}
}

View File

@@ -46,12 +46,12 @@ namespace BetterLyrics.WinUI3.Services.TranslateService
return ChineseConverter.ConvertToTraditionalChinese(text);
}
if (string.IsNullOrEmpty(_settingsService.LibreTranslateServer))
if (string.IsNullOrEmpty(_settingsService.AppSettings.LibreTranslateServer))
{
throw new Exception("LibreTranslate server URL is not set in settings.");
}
var url = $"{_settingsService.LibreTranslateServer}/translate";
var url = $"{_settingsService.AppSettings.LibreTranslateServer}/translate";
var response = await _httpClient.PostAsync(url, new FormUrlEncodedContent(
[
new("q", text),

View File

@@ -563,7 +563,7 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
<value>Easing animation type</value>
</data>
<data name="SettingsPagePlaybackLib.Content" xml:space="preserve">
<value>Playback and lyrics sources</value>
<value>Playback sources</value>
</data>
<data name="SettingsPageMediaSourceProvidersConfig.Header" xml:space="preserve">
<value>Monitor this playback source</value>
@@ -997,4 +997,7 @@ If you encounter any problems, please go to the Settings page, About tab, and vi
<data name="ImportSettingsFailed" xml:space="preserve">
<value>Settings file import failed, application settings remain unchanged</value>
</data>
<data name="ExportSettingsSuccess" xml:space="preserve">
<value>Export successful</value>
</data>
</root>

View File

@@ -563,7 +563,7 @@
<value>アニメーションタイプを緩和します</value>
</data>
<data name="SettingsPagePlaybackLib.Content" xml:space="preserve">
<value>プレイと歌詞</value>
<value>再生ソース</value>
</data>
<data name="SettingsPageMediaSourceProvidersConfig.Header" xml:space="preserve">
<value>この再生ソースを監視します</value>
@@ -997,4 +997,7 @@
<data name="ImportSettingsFailed" xml:space="preserve">
<value>設定ファイルのインポートに失敗し、アプリケーション設定は変更されません</value>
</data>
<data name="ExportSettingsSuccess" xml:space="preserve">
<value>エクスポートが成功しました</value>
</data>
</root>

View File

@@ -563,7 +563,7 @@
<value>애니메이션 유형 완화</value>
</data>
<data name="SettingsPagePlaybackLib.Content" xml:space="preserve">
<value>연극과 가사</value>
<value>재생 소스</value>
</data>
<data name="SettingsPageMediaSourceProvidersConfig.Header" xml:space="preserve">
<value>이 재생 소스를 모니터링하십시오</value>
@@ -997,4 +997,7 @@
<data name="ImportSettingsFailed" xml:space="preserve">
<value>설정 파일 가져 오기 실패, 응용 프로그램 설정은 변경되지 않았습니다</value>
</data>
<data name="ExportSettingsSuccess" xml:space="preserve">
<value>수출 성공</value>
</data>
</root>

View File

@@ -563,7 +563,7 @@
<value>缓动动画类型</value>
</data>
<data name="SettingsPagePlaybackLib.Content" xml:space="preserve">
<value>播放与歌词源</value>
<value>播放源</value>
</data>
<data name="SettingsPageMediaSourceProvidersConfig.Header" xml:space="preserve">
<value>监听此播放源</value>
@@ -997,4 +997,7 @@
<data name="ImportSettingsFailed" xml:space="preserve">
<value>设置文件导入失败,应用程序设置保持不变</value>
</data>
<data name="ExportSettingsSuccess" xml:space="preserve">
<value>导出成功</value>
</data>
</root>

View File

@@ -563,7 +563,7 @@
<value>緩動動畫類型</value>
</data>
<data name="SettingsPagePlaybackLib.Content" xml:space="preserve">
<value>播放與歌詞源</value>
<value>播放源</value>
</data>
<data name="SettingsPageMediaSourceProvidersConfig.Header" xml:space="preserve">
<value>監聽此播放來源</value>
@@ -997,4 +997,7 @@
<data name="ImportSettingsFailed" xml:space="preserve">
<value>設置文件導入失敗,應用程序設置保持不變</value>
</data>
<data name="ExportSettingsSuccess" xml:space="preserve">
<value>導出成功</value>
</data>
</root>

View File

@@ -40,16 +40,14 @@ namespace BetterLyrics.WinUI3.ViewModels
public LyricsPageViewModel(ISettingsService settingsService, IMediaSessionsService mediaSessionsService) : base(settingsService)
{
IsFirstRun = _settingsService.IsFirstRun;
IsTranslationEnabled = _settingsService.IsTranslationEnabled;
DisplayType = _settingsService.DisplayType;
PositionOffset = _settingsService.PositionOffset;
IsImmersiveMode = _settingsService.IsImmersiveMode;
ShowTranslationOnly = _settingsService.ShowTranslationOnly;
IsTranslationEnabled = _settingsService.AppSettings.IsTranslationEnabled;
DisplayType = _settingsService.AppSettings.DisplayType;
IsImmersiveMode = _settingsService.AppSettings.IsImmersiveMode;
ShowTranslationOnly = _settingsService.AppSettings.ShowTranslationOnly;
UpdateHintMessageFontSize();
LyricsFontFamily = _settingsService.LyricsFontFamily;
LyricsFontFamily = _settingsService.AppSettings.LyricsFontFamily;
OnIsImmersiveModeChanged(IsImmersiveMode);
@@ -113,19 +111,9 @@ namespace BetterLyrics.WinUI3.ViewModels
[NotifyPropertyChangedRecipients]
public partial LyricsDisplayType DisplayType { get; set; }
[ObservableProperty]
public partial bool IsFirstRun { get; set; }
[ObservableProperty]
public partial bool IsWelcomeTeachingTipOpen { get; set; }
[ObservableProperty]
public partial SongInfo? SongInfo { get; set; } = null;
[ObservableProperty]
[NotifyPropertyChangedRecipients]
public partial int PositionOffset { get; set; }
[ObservableProperty]
[NotifyPropertyChangedRecipients]
public partial bool IsTranslationEnabled { get; set; }
@@ -147,15 +135,15 @@ namespace BetterLyrics.WinUI3.ViewModels
{
if (_isDockMode)
{
HintMessageFontSize = _settingsService.LyricsDockFontSize;
HintMessageFontSize = _settingsService.AppSettings.LyricsDockFontSize;
}
else if (_isDesktopMode)
{
HintMessageFontSize = _settingsService.LyricsDesktopFontSize;
HintMessageFontSize = _settingsService.AppSettings.LyricsDesktopFontSize;
}
else
{
HintMessageFontSize = _settingsService.LyricsStandardFontSize;
HintMessageFontSize = _settingsService.AppSettings.LyricsStandardFontSize;
}
}
@@ -172,7 +160,7 @@ namespace BetterLyrics.WinUI3.ViewModels
}
else
{
DisplayType = _settingsService.DisplayType;
DisplayType = _settingsService.AppSettings.DisplayType;
}
UpdateHintMessageFontSize();
}
@@ -185,7 +173,7 @@ namespace BetterLyrics.WinUI3.ViewModels
}
else
{
DisplayType = _settingsService.DisplayType;
DisplayType = _settingsService.AppSettings.DisplayType;
}
UpdateHintMessageFontSize();
}
@@ -226,20 +214,9 @@ namespace BetterLyrics.WinUI3.ViewModels
await _mediaSessionsService.NextAsync();
}
partial void OnIsFirstRunChanged(bool value)
{
IsWelcomeTeachingTipOpen = value;
_settingsService.IsFirstRun = false;
}
partial void OnIsTranslationEnabledChanged(bool value)
{
_settingsService.IsTranslationEnabled = value;
}
partial void OnPositionOffsetChanged(int value)
{
_settingsService.PositionOffset = value;
_settingsService.AppSettings.IsTranslationEnabled = value;
}
partial void OnIsImmersiveModeChanged(bool value)
@@ -258,7 +235,7 @@ namespace BetterLyrics.WinUI3.ViewModels
partial void OnShowTranslationOnlyChanged(bool value)
{
_settingsService.ShowTranslationOnly = value;
_settingsService.AppSettings.ShowTranslationOnly = value;
}
public void Receive(PropertyChangedMessage<int> message)

View File

@@ -30,68 +30,68 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
_lastFMService = lastFMService;
_mediaSourceProvidersInfo = _settingsService.MediaSourceProvidersInfo;
_mediaSourceProvidersInfo = _settingsService.AppSettings.MediaSourceProvidersInfo;
_logger = Ioc.Default.GetRequiredService<ILogger<LyricsRendererViewModel>>();
_albumArtCornerRadius = _settingsService.CoverImageRadius;
_albumArtBgOpacity = _settingsService.CoverOverlayOpacity;
_albumArtBgBlurAmount = _settingsService.CoverOverlayBlurAmount;
_coverAcrylicEffectAmount = _settingsService.CoverAcrylicEffectAmount;
_coverOverlaySpeed = _settingsService.CoverOverlaySpeed;
_albumArtCornerRadius = _settingsService.AppSettings.CoverImageRadius;
_albumArtBgOpacity = _settingsService.AppSettings.CoverOverlayOpacity;
_albumArtBgBlurAmount = _settingsService.AppSettings.CoverOverlayBlurAmount;
_coverAcrylicEffectAmount = _settingsService.AppSettings.CoverAcrylicEffectAmount;
_coverOverlaySpeed = _settingsService.AppSettings.CoverOverlaySpeed;
_lyricsBgFontColorType = _settingsService.LyricsBgFontColorType;
_lyricsFgFontColorType = _settingsService.LyricsFgFontColorType;
_lyricsBgFontColorType = _settingsService.AppSettings.LyricsBgFontColorType;
_lyricsFgFontColorType = _settingsService.AppSettings.LyricsFgFontColorType;
_lyricsTextFormat.FontWeight = _settingsService.LyricsFontWeight.ToFontWeight();
_lyricsTextFormat.FontWeight = _settingsService.AppSettings.LyricsFontWeight.ToFontWeight();
_lyricsTextFormat.FontFamily = _artistTextFormat.FontFamily = _titleTextFormat.FontFamily = _settingsService.LyricsFontFamily;
_lyricsTextFormat.FontFamily = _artistTextFormat.FontFamily = _titleTextFormat.FontFamily = _settingsService.AppSettings.LyricsFontFamily;
_lyricsAlignmentType = _settingsService.LyricsAlignmentType;
_lyricsVerticalEdgeOpacity = _settingsService.LyricsVerticalEdgeOpacity;
_lyricsLineSpacingFactor = _settingsService.LyricsLineSpacingFactor;
_lyricsAlignmentType = _settingsService.AppSettings.LyricsAlignmentType;
_lyricsVerticalEdgeOpacity = _settingsService.AppSettings.LyricsVerticalEdgeOpacity;
_lyricsLineSpacingFactor = _settingsService.AppSettings.LyricsLineSpacingFactor;
_lyricsStandardFontSize = _settingsService.LyricsStandardFontSize;
_lyricsDockFontSize = _settingsService.LyricsDockFontSize;
_lyricsDesktopFontSize = _settingsService.LyricsDesktopFontSize;
_lyricsStandardFontSize = _settingsService.AppSettings.LyricsStandardFontSize;
_lyricsDockFontSize = _settingsService.AppSettings.LyricsDockFontSize;
_lyricsDesktopFontSize = _settingsService.AppSettings.LyricsDesktopFontSize;
_lyricsBlurAmount = _settingsService.LyricsBlurAmount;
_isLyricsGlowEffectEnabled = _settingsService.IsLyricsGlowEffectEnabled;
_lyricsGlowEffectScope = _settingsService.LyricsGlowEffectScope;
_lyricsHighlightScope = _settingsService.LyricsHighlightScope;
_lyricsBlurAmount = _settingsService.AppSettings.LyricsBlurAmount;
_isLyricsGlowEffectEnabled = _settingsService.AppSettings.IsLyricsGlowEffectEnabled;
_lyricsGlowEffectScope = _settingsService.AppSettings.LyricsGlowEffectScope;
_lyricsHighlightScope = _settingsService.AppSettings.LyricsHighlightScope;
_customBgFontColor = _settingsService.LyricsCustomBgFontColor;
_customFgFontColor = _settingsService.LyricsCustomFgFontColor;
_customBgFontColor = _settingsService.AppSettings.LyricsCustomBgFontColor;
_customFgFontColor = _settingsService.AppSettings.LyricsCustomFgFontColor;
_lyricsBgTheme = _settingsService.LyricsBackgroundTheme;
_lyricsBgTheme = _settingsService.AppSettings.LyricsBackgroundTheme;
_isFanLyricsEnabled = _settingsService.IsFanLyricsEnabled;
_isFanLyricsEnabled = _settingsService.AppSettings.IsFanLyricsEnabled;
// 歌词描边
_lyricsFontStrokeWidth = _settingsService.LyricsFontStrokeWidth;
_lyricsStrokeFontColorType = _settingsService.LyricsStrokeFontColorType;
_customStrokeFontColor = _settingsService.LyricsCustomStrokeFontColor;
_lyricsFontStrokeWidth = _settingsService.AppSettings.LyricsFontStrokeWidth;
_lyricsStrokeFontColorType = _settingsService.AppSettings.LyricsStrokeFontColorType;
_customStrokeFontColor = _settingsService.AppSettings.LyricsCustomStrokeFontColor;
_isTranslationEnabled = _settingsService.IsTranslationEnabled;
_showTranslationOnly = _settingsService.ShowTranslationOnly;
_isLibreTranslateEnabled = _settingsService.IsLibreTranslateEnabled;
_targetLanguageIndex = _settingsService.SelectedTargetLanguageIndex;
_lyricsTranslationSeparator = _settingsService.LyricsTranslationSeparator;
_isTranslationEnabled = _settingsService.AppSettings.IsTranslationEnabled;
_showTranslationOnly = _settingsService.AppSettings.ShowTranslationOnly;
_isLibreTranslateEnabled = _settingsService.AppSettings.IsLibreTranslateEnabled;
_targetLanguageIndex = _settingsService.AppSettings.SelectedTargetLanguageIndex;
_lyricsTranslationSeparator = _settingsService.AppSettings.LyricsTranslationSeparator;
_dockPlacement = _settingsService.DockPlacement;
_dockPlacement = _settingsService.AppSettings.DockPlacement;
_titleTextFormat.HorizontalAlignment = _artistTextFormat.HorizontalAlignment = _settingsService.SongInfoAlignmentType.ToCanvasHorizontalAlignment();
_titleTextFormat.HorizontalAlignment = _artistTextFormat.HorizontalAlignment = _settingsService.AppSettings.SongInfoAlignmentType.ToCanvasHorizontalAlignment();
_timelineSyncThreshold = 0;
_lyricsScrollTopDuration = _settingsService.LyricsScrollTopDuration / 1000.0;
_lyricsScrollBottomDuration = _settingsService.LyricsScrollBottomDuration / 1000.0;
_canvasYScrollTransition.SetDuration(_settingsService.LyricsScrollDuration / 1000.0);
_canvasYScrollTransition.SetEasingType(_settingsService.LyricsScrollEasingType);
_defaultOpacity = _settingsService.LyricsBgFontOpacity / 100f;
_lyricsScrollTopDuration = _settingsService.AppSettings.LyricsScrollTopDuration / 1000.0;
_lyricsScrollBottomDuration = _settingsService.AppSettings.LyricsScrollBottomDuration / 1000.0;
_canvasYScrollTransition.SetDuration(_settingsService.AppSettings.LyricsScrollDuration / 1000.0);
_canvasYScrollTransition.SetEasingType(_settingsService.AppSettings.LyricsScrollEasingType);
_defaultOpacity = _settingsService.AppSettings.LyricsBgFontOpacity / 100f;
_isLyricsFloatAnimationEnabled = _settingsService.IsLyricsFloatAnimationEnabled;
_displayType = _displayTypeReceived = _settingsService.DisplayType;
_isLyricsFloatAnimationEnabled = _settingsService.AppSettings.IsLyricsFloatAnimationEnabled;
_displayType = _displayTypeReceived = _settingsService.AppSettings.DisplayType;
_libWatcherService.MusicLibraryFilesChanged +=
LibWatcherService_MusicLibraryFilesChanged;

View File

@@ -53,7 +53,6 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
private OpacityEffect? CreateFgImageEffect(ICanvasAnimatedControl control, CanvasBitmap canvasBitmap, double opacity)
{
// TODO 最大化/还原时图片大小未跟随改变
if (opacity == 0) return null;
double imageWidth = (double)canvasBitmap.Size.Width;

View File

@@ -564,6 +564,11 @@ namespace BetterLyrics.WinUI3.ViewModels.LyricsRendererViewModel
line.OpacityTransition.StartTransition(_defaultOpacity - distanceFactor * _defaultOpacity * (1 - _lyricsVerticalEdgeOpacity / 100f));
line.HighlightOpacityTransition.StartTransition(i == _playingLineIndex ? 1f : 0f);
if (line.YOffsetTransition.IsTransitioning)
{
Debug.WriteLine($"Line {i} YOffsetTransition is already transitioning, skipping update.");
}
double yScrollDuration;
if (lineCountDelta < 0)
{

View File

@@ -49,13 +49,13 @@ namespace BetterLyrics.WinUI3
public LyricsWindowViewModel(ISettingsService settingsService) : base(settingsService)
{
_dockMonitorDeviceName = _settingsService.DockMonitorDeviceName;
_ignoreFullscreenWindow = _settingsService.IgnoreFullscreenWindow;
_hideWindowWhenNotPlaying = _settingsService.HideWindowWhenNotPlaying;
IsImmersiveMode = _settingsService.IsImmersiveMode;
_dockPlacement = _settingsService.DockPlacement;
_dockWindowHeight = _settingsService.DockWindowHeight;
OnIsImmersiveModeChanged(_settingsService.IsImmersiveMode);
_dockMonitorDeviceName = _settingsService.AppSettings.DockMonitorDeviceName;
_ignoreFullscreenWindow = _settingsService.AppSettings.IgnoreFullscreenWindow;
_hideWindowWhenNotPlaying = _settingsService.AppSettings.HideWindowWhenNotPlaying;
IsImmersiveMode = _settingsService.AppSettings.IsImmersiveMode;
_dockPlacement = _settingsService.AppSettings.DockPlacement;
_dockWindowHeight = _settingsService.AppSettings.DockWindowHeight;
OnIsImmersiveModeChanged(_settingsService.AppSettings.IsImmersiveMode);
_mediaSessionsService.IsPlayingChanged += PlaybackService_IsPlayingChanged;
}
@@ -251,12 +251,12 @@ namespace BetterLyrics.WinUI3
public void UpdateAccentColor(nint hwnd)
{
WindowPixelSampleMode mode = IsDesktopMode ? WindowPixelSampleMode.WindowEdge : _dockPlacement.ToWindowPixelSampleMode();
ActivatedWindowAccentColor = Helper.ColorHelper.GetAccentColor(hwnd, _settingsService.DockMonitorDeviceName, mode).ToColor();
ActivatedWindowAccentColor = Helper.ColorHelper.GetAccentColor(hwnd, _settingsService.AppSettings.DockMonitorDeviceName, mode).ToColor();
}
public void InitLockHotKey()
{
UpdateLockHotKey(_settingsService.LockHotKeyIndex);
UpdateLockHotKey(_settingsService.AppSettings.LockHotKeyIndex);
}
[RelayCommand]
@@ -269,7 +269,7 @@ namespace BetterLyrics.WinUI3
{
DesktopModeHelper.SetClickThrough(window, false);
IsLyricsWindowLocked = false;
IsImmersiveMode = _settingsService.IsImmersiveMode;
IsImmersiveMode = _settingsService.AppSettings.IsImmersiveMode;
}
else
{
@@ -327,7 +327,7 @@ namespace BetterLyrics.WinUI3
[RelayCommand]
private void OnImmersiveToggleButtonEnabledChanged()
{
_settingsService.IsImmersiveMode = IsImmersiveMode;
_settingsService.AppSettings.IsImmersiveMode = IsImmersiveMode;
}
public void Receive(PropertyChangedMessage<DockPlacement> message)

View File

@@ -91,7 +91,7 @@ namespace BetterLyrics.WinUI3.ViewModels
RefreshSongs();
PlaybackOrder = _settingsService.PlaybackOrder;
PlaybackOrder = _settingsService.AppSettings.PlaybackOrder;
_mediaPlayer.MediaOpened += MediaPlayer_MediaOpened;
_mediaPlayer.MediaEnded += MediaPlayer_MediaEnded;
@@ -242,7 +242,7 @@ namespace BetterLyrics.WinUI3.ViewModels
Task.Run(() =>
{
foreach (var folder in _settingsService.LocalMediaFolders)
foreach (var folder in _settingsService.AppSettings.LocalMediaFolders)
{
if (Directory.Exists(folder.Path) && folder.IsEnabled)
{
@@ -405,7 +405,7 @@ namespace BetterLyrics.WinUI3.ViewModels
partial void OnPlaybackOrderChanged(PlaybackOrder value)
{
_settingsService.PlaybackOrder = value;
_settingsService.AppSettings.PlaybackOrder = value;
}
public void Receive(PropertyChangedMessage<ObservableCollection<LocalMediaFolder>> message)

View File

@@ -33,79 +33,79 @@ namespace BetterLyrics.WinUI3.ViewModels.SettingsPageViewModel
IsLastFMAuthenticated = _lastFMService.IsAuthenticated;
LastFMUser = _lastFMService.User;
IsLibreTranslateEnabled = _settingsService.IsLibreTranslateEnabled;
LibreTranslateServer = _settingsService.LibreTranslateServer;
SelectedTargetLanguageIndex = _settingsService.SelectedTargetLanguageIndex;
IsLibreTranslateEnabled = _settingsService.AppSettings.IsLibreTranslateEnabled;
LibreTranslateServer = _settingsService.AppSettings.LibreTranslateServer;
SelectedTargetLanguageIndex = _settingsService.AppSettings.SelectedTargetLanguageIndex;
LocalMediaFolders = [.. _settingsService.LocalMediaFolders];
LocalMediaFolders = [.. _settingsService.AppSettings.LocalMediaFolders];
Language = _settingsService.Language;
CoverImageRadius = _settingsService.CoverImageRadius;
Language = _settingsService.AppSettings.Language;
CoverImageRadius = _settingsService.AppSettings.CoverImageRadius;
AutoStartWindowType = _settingsService.AutoStartWindowType;
AutoLockOnDesktopMode = _settingsService.AutoLockOnDesktopMode;
AutoStartWindowType = _settingsService.AppSettings.AutoStartWindowType;
AutoLockOnDesktopMode = _settingsService.AppSettings.AutoLockOnDesktopMode;
CoverOverlayOpacity = _settingsService.CoverOverlayOpacity;
CoverOverlayBlurAmount = _settingsService.CoverOverlayBlurAmount;
CoverOverlaySpeed = _settingsService.CoverOverlaySpeed;
CoverOverlayOpacity = _settingsService.AppSettings.CoverOverlayOpacity;
CoverOverlayBlurAmount = _settingsService.AppSettings.CoverOverlayBlurAmount;
CoverOverlaySpeed = _settingsService.AppSettings.CoverOverlaySpeed;
CoverAcrylicEffectAmount = _settingsService.CoverAcrylicEffectAmount;
CoverAcrylicEffectAmount = _settingsService.AppSettings.CoverAcrylicEffectAmount;
LyricsAlignmentType = _settingsService.LyricsAlignmentType;
SongInfoAlignmentType = _settingsService.SongInfoAlignmentType;
LyricsFontWeight = _settingsService.LyricsFontWeight;
LyricsBlurAmount = _settingsService.LyricsBlurAmount;
LyricsVerticalEdgeOpacity = _settingsService.LyricsVerticalEdgeOpacity;
LyricsLineSpacingFactor = _settingsService.LyricsLineSpacingFactor;
LyricsAlignmentType = _settingsService.AppSettings.LyricsAlignmentType;
SongInfoAlignmentType = _settingsService.AppSettings.SongInfoAlignmentType;
LyricsFontWeight = _settingsService.AppSettings.LyricsFontWeight;
LyricsBlurAmount = _settingsService.AppSettings.LyricsBlurAmount;
LyricsVerticalEdgeOpacity = _settingsService.AppSettings.LyricsVerticalEdgeOpacity;
LyricsLineSpacingFactor = _settingsService.AppSettings.LyricsLineSpacingFactor;
// Font size
LyricsStandardFontSize = _settingsService.LyricsStandardFontSize;
LyricsDockFontSize = _settingsService.LyricsDockFontSize;
LyricsDesktopFontSize = _settingsService.LyricsDesktopFontSize;
LyricsStandardFontSize = _settingsService.AppSettings.LyricsStandardFontSize;
LyricsDockFontSize = _settingsService.AppSettings.LyricsDockFontSize;
LyricsDesktopFontSize = _settingsService.AppSettings.LyricsDesktopFontSize;
IsLyricsGlowEffectEnabled = _settingsService.IsLyricsGlowEffectEnabled;
LyricsGlowEffectScope = _settingsService.LyricsGlowEffectScope;
LyricsHighlightScope = _settingsService.LyricsHighlightScope;
IsFanLyricsEnabled = _settingsService.IsFanLyricsEnabled;
IsLyricsGlowEffectEnabled = _settingsService.AppSettings.IsLyricsGlowEffectEnabled;
LyricsGlowEffectScope = _settingsService.AppSettings.LyricsGlowEffectScope;
LyricsHighlightScope = _settingsService.AppSettings.LyricsHighlightScope;
IsFanLyricsEnabled = _settingsService.AppSettings.IsFanLyricsEnabled;
LyricsBgFontColorType = _settingsService.LyricsBgFontColorType;
LyricsFgFontColorType = _settingsService.LyricsFgFontColorType;
LyricsStrokeFontColorType = _settingsService.LyricsStrokeFontColorType;
LyricsBgFontColorType = _settingsService.AppSettings.LyricsBgFontColorType;
LyricsFgFontColorType = _settingsService.AppSettings.LyricsFgFontColorType;
LyricsStrokeFontColorType = _settingsService.AppSettings.LyricsStrokeFontColorType;
LyricsCustomBgFontColor = _settingsService.LyricsCustomBgFontColor;
LyricsCustomFgFontColor = _settingsService.LyricsCustomFgFontColor;
LyricsCustomStrokeFontColor = _settingsService.LyricsCustomStrokeFontColor;
LyricsCustomBgFontColor = _settingsService.AppSettings.LyricsCustomBgFontColor;
LyricsCustomFgFontColor = _settingsService.AppSettings.LyricsCustomFgFontColor;
LyricsCustomStrokeFontColor = _settingsService.AppSettings.LyricsCustomStrokeFontColor;
LyricsFontStrokeWidth = _settingsService.LyricsFontStrokeWidth;
LyricsBackgroundTheme = _settingsService.LyricsBackgroundTheme;
MediaSourceProvidersInfo = [.. _settingsService.MediaSourceProvidersInfo];
LyricsFontStrokeWidth = _settingsService.AppSettings.LyricsFontStrokeWidth;
LyricsBackgroundTheme = _settingsService.AppSettings.LyricsBackgroundTheme;
MediaSourceProvidersInfo = [.. _settingsService.AppSettings.MediaSourceProvidersInfo];
SelectedMediaSourceProvider = MediaSourceProvidersInfo.FirstOrDefault();
IgnoreFullscreenWindow = _settingsService.IgnoreFullscreenWindow;
IgnoreFullscreenWindow = _settingsService.AppSettings.IgnoreFullscreenWindow;
LyricsScrollEasingType = _settingsService.LyricsScrollEasingType;
LyricsScrollDuration = _settingsService.LyricsScrollDuration;
LyricsScrollTopDuration = _settingsService.LyricsScrollTopDuration;
LyricsScrollBottomDuration = _settingsService.LyricsScrollBottomDuration;
LyricsScrollEasingType = _settingsService.AppSettings.LyricsScrollEasingType;
LyricsScrollDuration = _settingsService.AppSettings.LyricsScrollDuration;
LyricsScrollTopDuration = _settingsService.AppSettings.LyricsScrollTopDuration;
LyricsScrollBottomDuration = _settingsService.AppSettings.LyricsScrollBottomDuration;
IsLyricsFloatAnimationEnabled = _settingsService.IsLyricsFloatAnimationEnabled;
LockHotKeyIndex = _settingsService.LockHotKeyIndex;
IsLyricsFloatAnimationEnabled = _settingsService.AppSettings.IsLyricsFloatAnimationEnabled;
LockHotKeyIndex = _settingsService.AppSettings.LockHotKeyIndex;
LXMusicServer = _settingsService.LXMusicServer;
DockPlacement = _settingsService.DockPlacement;
LyricsBgFontOpacity = _settingsService.LyricsBgFontOpacity;
HideWindowWhenNotPlaying = _settingsService.HideWindowWhenNotPlaying;
DockWindowHeight = _settingsService.DockWindowHeight;
LXMusicServer = _settingsService.AppSettings.LXMusicServer;
DockPlacement = _settingsService.AppSettings.DockPlacement;
LyricsBgFontOpacity = _settingsService.AppSettings.LyricsBgFontOpacity;
HideWindowWhenNotPlaying = _settingsService.AppSettings.HideWindowWhenNotPlaying;
DockWindowHeight = _settingsService.AppSettings.DockWindowHeight;
SystemFontNames = [.. FontHelper.SystemFontFamilies];
SelectedFontFamilyIndex = _settingsService.SelectedFontFamilyIndex;
LyricsFontFamily = _settingsService.LyricsFontFamily;
IsDragEverywhereEnabled = _settingsService.IsDragEverywhereEnabled;
SelectedFontFamilyIndex = _settingsService.AppSettings.SelectedFontFamilyIndex;
LyricsFontFamily = _settingsService.AppSettings.LyricsFontFamily;
IsDragEverywhereEnabled = _settingsService.AppSettings.IsDragEverywhereEnabled;
MonitorDeviceNames = [.. MonitorHelper.GetAllMonitorDeviceNames()];
SelectedDockMonitorDeviceName = _settingsService.DockMonitorDeviceName;
SelectedDockMonitorDeviceName = _settingsService.AppSettings.DockMonitorDeviceName;
LyricsTranslationSeparator = _settingsService.LyricsTranslationSeparator;
LyricsTranslationSeparator = _settingsService.AppSettings.LyricsTranslationSeparator;
_mediaSessionsService.MediaSourceProvidersInfoChanged += MediaSessionsService_SessionIdsChanged;
_mediaSessionsService.SongInfoChanged += MediaSessionsService_SongInfoChanged;

View File

@@ -11,75 +11,75 @@ namespace BetterLyrics.WinUI3.ViewModels.SettingsPageViewModel
{
partial void OnDockPlacementChanged(DockPlacement value)
{
_settingsService.DockPlacement = value;
_settingsService.AppSettings.DockPlacement = value;
}
partial void OnLyricsScrollEasingTypeChanged(EasingType value)
{
_settingsService.LyricsScrollEasingType = value;
_settingsService.AppSettings.LyricsScrollEasingType = value;
}
partial void OnLyricsScrollDurationChanged(int value)
{
_settingsService.LyricsScrollDuration = value;
_settingsService.AppSettings.LyricsScrollDuration = value;
}
partial void OnLyricsScrollTopDurationChanged(int value)
{
_settingsService.LyricsScrollTopDuration = value;
_settingsService.AppSettings.LyricsScrollTopDuration = value;
}
partial void OnLyricsScrollBottomDurationChanged(int value)
{
_settingsService.LyricsScrollBottomDuration = value;
_settingsService.AppSettings.LyricsScrollBottomDuration = value;
}
partial void OnLyricsBackgroundThemeChanged(ElementTheme value)
{
_settingsService.LyricsBackgroundTheme = value;
_settingsService.AppSettings.LyricsBackgroundTheme = value;
}
partial void OnLyricsFontStrokeWidthChanged(int value)
{
_settingsService.LyricsFontStrokeWidth = value;
_settingsService.AppSettings.LyricsFontStrokeWidth = value;
}
partial void OnIgnoreFullscreenWindowChanged(bool value)
{
_settingsService.IgnoreFullscreenWindow = value;
_settingsService.AppSettings.IgnoreFullscreenWindow = value;
}
partial void OnSelectedTargetLanguageIndexChanged(int value)
{
_settingsService.SelectedTargetLanguageIndex = value;
_settingsService.AppSettings.SelectedTargetLanguageIndex = value;
}
partial void OnLibreTranslateServerChanged(string value)
{
_settingsService.LibreTranslateServer = value;
_settingsService.AppSettings.LibreTranslateServer = value;
}
partial void OnLXMusicServerChanged(string value)
{
_settingsService.LXMusicServer = value;
_settingsService.AppSettings.LXMusicServer = value;
}
partial void OnAutoStartWindowTypeChanged(AutoStartWindowType value)
{
_settingsService.AutoStartWindowType = value;
_settingsService.AppSettings.AutoStartWindowType = value;
}
partial void OnAutoLockOnDesktopModeChanged(bool value)
{
_settingsService.AutoLockOnDesktopMode = value;
_settingsService.AppSettings.AutoLockOnDesktopMode = value;
}
partial void OnCoverImageRadiusChanged(int value)
{
_settingsService.CoverImageRadius = value;
_settingsService.AppSettings.CoverImageRadius = value;
}
partial void OnCoverOverlayBlurAmountChanged(int value)
{
_settingsService.CoverOverlayBlurAmount = value;
_settingsService.AppSettings.CoverOverlayBlurAmount = value;
}
partial void OnCoverAcrylicEffectAmountChanged(int value)
{
_settingsService.CoverAcrylicEffectAmount = value;
_settingsService.AppSettings.CoverAcrylicEffectAmount = value;
}
partial void OnCoverOverlayOpacityChanged(int value)
{
_settingsService.CoverOverlayOpacity = value;
_settingsService.AppSettings.CoverOverlayOpacity = value;
}
partial void OnCoverOverlaySpeedChanged(int value)
{
_settingsService.CoverOverlaySpeed = value;
_settingsService.AppSettings.CoverOverlaySpeed = value;
}
partial void OnLanguageChanged(Enums.Language value)
{
@@ -106,112 +106,112 @@ namespace BetterLyrics.WinUI3.ViewModels.SettingsPageViewModel
default:
break;
}
_settingsService.Language = Language;
_settingsService.AppSettings.Language = Language;
}
partial void OnIsFanLyricsEnabledChanged(bool value)
{
_settingsService.IsFanLyricsEnabled = value;
_settingsService.AppSettings.IsFanLyricsEnabled = value;
}
partial void OnIsLyricsGlowEffectEnabledChanged(bool value)
{
_settingsService.IsLyricsGlowEffectEnabled = value;
_settingsService.AppSettings.IsLyricsGlowEffectEnabled = value;
}
partial void OnLyricsAlignmentTypeChanged(TextAlignmentType value)
{
_settingsService.LyricsAlignmentType = value;
_settingsService.AppSettings.LyricsAlignmentType = value;
}
partial void OnSongInfoAlignmentTypeChanged(TextAlignmentType value)
{
_settingsService.SongInfoAlignmentType = value;
_settingsService.AppSettings.SongInfoAlignmentType = value;
}
partial void OnLyricsBlurAmountChanged(int value)
{
_settingsService.LyricsBlurAmount = value;
_settingsService.AppSettings.LyricsBlurAmount = value;
}
partial void OnLyricsCustomBgFontColorChanged(Color value)
{
_settingsService.LyricsCustomBgFontColor = value;
_settingsService.AppSettings.LyricsCustomBgFontColor = value;
}
partial void OnLyricsCustomFgFontColorChanged(Color value)
{
_settingsService.LyricsCustomFgFontColor = value;
_settingsService.AppSettings.LyricsCustomFgFontColor = value;
}
partial void OnLyricsCustomStrokeFontColorChanged(Color value)
{
_settingsService.LyricsCustomStrokeFontColor = value;
_settingsService.AppSettings.LyricsCustomStrokeFontColor = value;
}
partial void OnLyricsBgFontColorTypeChanged(LyricsFontColorType value)
{
_settingsService.LyricsBgFontColorType = value;
_settingsService.AppSettings.LyricsBgFontColorType = value;
}
partial void OnLyricsFgFontColorTypeChanged(LyricsFontColorType value)
{
_settingsService.LyricsFgFontColorType = value;
_settingsService.AppSettings.LyricsFgFontColorType = value;
}
partial void OnLyricsStrokeFontColorTypeChanged(LyricsFontColorType value)
{
_settingsService.LyricsStrokeFontColorType = value;
_settingsService.AppSettings.LyricsStrokeFontColorType = value;
}
partial void OnLyricsStandardFontSizeChanged(int value)
{
_settingsService.LyricsStandardFontSize = value;
_settingsService.AppSettings.LyricsStandardFontSize = value;
}
partial void OnLyricsDockFontSizeChanged(int value)
{
_settingsService.LyricsDockFontSize = value;
_settingsService.AppSettings.LyricsDockFontSize = value;
}
partial void OnLyricsDesktopFontSizeChanged(int value)
{
_settingsService.LyricsDesktopFontSize = value;
_settingsService.AppSettings.LyricsDesktopFontSize = value;
}
partial void OnLyricsFontWeightChanged(LyricsFontWeight value)
{
_settingsService.LyricsFontWeight = value;
_settingsService.AppSettings.LyricsFontWeight = value;
}
partial void OnLyricsGlowEffectScopeChanged(LineRenderingType value)
{
_settingsService.LyricsGlowEffectScope = value;
_settingsService.AppSettings.LyricsGlowEffectScope = value;
}
partial void OnLyricsHighlightScopeChanged(LineRenderingType value)
{
_settingsService.LyricsHighlightScope = value;
_settingsService.AppSettings.LyricsHighlightScope = value;
}
partial void OnLyricsLineSpacingFactorChanged(double value)
{
_settingsService.LyricsLineSpacingFactor = value;
_settingsService.AppSettings.LyricsLineSpacingFactor = value;
}
partial void OnLyricsVerticalEdgeOpacityChanged(int value)
{
_settingsService.LyricsVerticalEdgeOpacity = value;
_settingsService.AppSettings.LyricsVerticalEdgeOpacity = value;
}
partial void OnIsLyricsFloatAnimationEnabledChanged(bool value)
{
_settingsService.IsLyricsFloatAnimationEnabled = value;
_settingsService.AppSettings.IsLyricsFloatAnimationEnabled = value;
}
partial void OnLyricsBgFontOpacityChanged(int value)
{
_settingsService.LyricsBgFontOpacity = value;
_settingsService.AppSettings.LyricsBgFontOpacity = value;
}
partial void OnHideWindowWhenNotPlayingChanged(bool value)
{
_settingsService.HideWindowWhenNotPlaying = value;
_settingsService.AppSettings.HideWindowWhenNotPlaying = value;
}
partial void OnDockWindowHeightChanged(int value)
{
_settingsService.DockWindowHeight = value;
_settingsService.AppSettings.DockWindowHeight = value;
}
partial void OnSelectedFontFamilyIndexChanged(int value)
{
_settingsService.SelectedFontFamilyIndex = value;
_settingsService.AppSettings.SelectedFontFamilyIndex = value;
LyricsFontFamily = SystemFontNames[value];
}
partial void OnLyricsFontFamilyChanged(string value)
{
_settingsService.LyricsFontFamily = value;
_settingsService.AppSettings.LyricsFontFamily = value;
}
partial void OnIsDragEverywhereEnabledChanged(bool value)
{
_settingsService.IsDragEverywhereEnabled = value;
_settingsService.AppSettings.IsDragEverywhereEnabled = value;
LyricsWindow? lyricsWindow = WindowHelper.GetWindowByWindowType<LyricsWindow>();
if (lyricsWindow != null)
@@ -221,15 +221,15 @@ namespace BetterLyrics.WinUI3.ViewModels.SettingsPageViewModel
}
partial void OnIsLibreTranslateEnabledChanged(bool value)
{
_settingsService.IsLibreTranslateEnabled = value;
_settingsService.AppSettings.IsLibreTranslateEnabled = value;
}
partial void OnSelectedDockMonitorDeviceNameChanged(string value)
{
_settingsService.DockMonitorDeviceName = value;
_settingsService.AppSettings.DockMonitorDeviceName = value;
}
partial void OnLyricsTranslationSeparatorChanged(string value)
{
_settingsService.LyricsTranslationSeparator = value;
_settingsService.AppSettings.LyricsTranslationSeparator = value;
}
}
}

View File

@@ -39,14 +39,14 @@ namespace BetterLyrics.WinUI3.ViewModels.SettingsPageViewModel
public void RemoveFolderAsync(LocalMediaFolder folder)
{
LocalMediaFolders.Remove(folder);
_settingsService.LocalMediaFolders = [.. LocalMediaFolders];
_settingsService.AppSettings.LocalMediaFolders = [.. LocalMediaFolders];
_libWatcherService.UpdateWatchers([.. LocalMediaFolders]);
Broadcast(LocalMediaFolders, LocalMediaFolders, nameof(LocalMediaFolders));
}
public void ToggleLocalLyricsFolder()
{
_settingsService.LocalMediaFolders = [.. LocalMediaFolders];
_settingsService.AppSettings.LocalMediaFolders = [.. LocalMediaFolders];
Broadcast(LocalMediaFolders, LocalMediaFolders, nameof(LocalMediaFolders));
}
@@ -54,7 +54,7 @@ namespace BetterLyrics.WinUI3.ViewModels.SettingsPageViewModel
{
_dispatcherQueueTimer.Debounce(() =>
{
_settingsService.MediaSourceProvidersInfo = [.. MediaSourceProvidersInfo];
_settingsService.AppSettings.MediaSourceProvidersInfo = [.. MediaSourceProvidersInfo];
Broadcast(
MediaSourceProvidersInfo,
MediaSourceProvidersInfo,
@@ -85,7 +85,7 @@ namespace BetterLyrics.WinUI3.ViewModels.SettingsPageViewModel
else
{
LocalMediaFolders.Add(new LocalMediaFolder(path, true));
_settingsService.LocalMediaFolders = [.. LocalMediaFolders];
_settingsService.AppSettings.LocalMediaFolders = [.. LocalMediaFolders];
_libWatcherService.UpdateWatchers([.. LocalMediaFolders]);
Broadcast(LocalMediaFolders, LocalMediaFolders, nameof(LocalMediaFolders));
}
@@ -171,6 +171,7 @@ namespace BetterLyrics.WinUI3.ViewModels.SettingsPageViewModel
if (folder != null)
{
_settingsService.ExportSettings(folder.Path);
App.Current.SettingsWindowNotificationPanel?.Notify(App.ResourceLoader?.GetString("ExportSettingsSuccess") ?? "", InfoBarSeverity.Success);
}
}

View File

@@ -352,13 +352,6 @@
</Grid.ContextFlyout>
</Grid>
<TeachingTip
x:Name="WelcomeTeachingTip"
x:Uid="MainPageWelcomeTeachingTip"
Closed="WelcomeTeachingTip_Closed"
IsOpen="{x:Bind ViewModel.IsWelcomeTeachingTipOpen, Mode=OneWay}"
Target="{x:Bind RootGrid}" />
<uc:SystemTray />
<VisualStateManager.VisualStateGroups>

View File

@@ -28,27 +28,22 @@ namespace BetterLyrics.WinUI3.Views
DataContext = Ioc.Default.GetRequiredService<LyricsPageViewModel>();
}
private void WelcomeTeachingTip_Closed(TeachingTip sender, TeachingTipClosedEventArgs args)
{
ViewModel.IsFirstRun = false;
}
private void LyricsOnlyRadioButton_Click(object sender, RoutedEventArgs e)
{
ViewModel.DisplayType = LyricsDisplayType.LyricsOnly;
_settingsService.DisplayType = ViewModel.DisplayType;
_settingsService.AppSettings.DisplayType = ViewModel.DisplayType;
}
private void AlbumArtOnlyRadioButton_Click(object sender, RoutedEventArgs e)
{
ViewModel.DisplayType = LyricsDisplayType.AlbumArtOnly;
_settingsService.DisplayType = ViewModel.DisplayType;
_settingsService.AppSettings.DisplayType = ViewModel.DisplayType;
}
private void SplitViewRadioButton_Click(object sender, RoutedEventArgs e)
{
ViewModel.DisplayType = LyricsDisplayType.SplitView;
_settingsService.DisplayType = ViewModel.DisplayType;
_settingsService.AppSettings.DisplayType = ViewModel.DisplayType;
}
private void BottomCommandGrid_PointerEntered(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)

View File

@@ -46,7 +46,7 @@ namespace BetterLyrics.WinUI3.Views
public void UpdateTitleBarArea()
{
if (_settingsService.IsDragEverywhereEnabled)
if (_settingsService.AppSettings.IsDragEverywhereEnabled)
{
SetTitleBar(RootGrid);
}
@@ -69,15 +69,15 @@ namespace BetterLyrics.WinUI3.Views
public void AutoSelectLyricsMode(AutoStartWindowType? type = null, bool? autoLook = null)
{
type ??= _settingsService.AutoStartWindowType;
type ??= _settingsService.AppSettings.AutoStartWindowType;
switch (type!)
{
case AutoStartWindowType.StandardMode:
AppWindow.MoveAndResize(new Windows.Graphics.RectInt32(
_settingsService.StandardWindowLeft,
_settingsService.StandardWindowTop,
_settingsService.StandardWindowWidth,
_settingsService.StandardWindowHeight));
_settingsService.AppSettings.StandardWindowLeft,
_settingsService.AppSettings.StandardWindowTop,
_settingsService.AppSettings.StandardWindowWidth,
_settingsService.AppSettings.StandardWindowHeight));
break;
case AutoStartWindowType.DockMode:
DockFlyoutItem.IsChecked = true;
@@ -86,7 +86,7 @@ namespace BetterLyrics.WinUI3.Views
case AutoStartWindowType.DesktopMode:
DesktopFlyoutItem.IsChecked = true;
ViewModel.ToggleDesktopModeCommand.Execute(null);
if (autoLook == null && _settingsService.AutoLockOnDesktopMode)
if (autoLook == null && _settingsService.AppSettings.AutoLockOnDesktopMode)
{
ViewModel.ToggleLockWindowCommand.Execute(null);
}
@@ -120,10 +120,10 @@ namespace BetterLyrics.WinUI3.Views
{
if (ViewModel.IsDesktopMode)
{
_settingsService.DesktopWindowLeft = rect.X;
_settingsService.DesktopWindowTop = rect.Y;
_settingsService.DesktopWindowWidth = size.Width;
_settingsService.DesktopWindowHeight = size.Height;
_settingsService.AppSettings.DesktopWindowLeft = rect.X;
_settingsService.AppSettings.DesktopWindowTop = rect.Y;
_settingsService.AppSettings.DesktopWindowWidth = size.Width;
_settingsService.AppSettings.DesktopWindowHeight = size.Height;
}
else if (ViewModel.IsDockMode)
{
@@ -131,10 +131,10 @@ namespace BetterLyrics.WinUI3.Views
}
else
{
_settingsService.StandardWindowLeft = rect.X;
_settingsService.StandardWindowTop = rect.Y;
_settingsService.StandardWindowWidth = size.Width;
_settingsService.StandardWindowHeight = size.Height;
_settingsService.AppSettings.StandardWindowLeft = rect.X;
_settingsService.AppSettings.StandardWindowTop = rect.Y;
_settingsService.AppSettings.StandardWindowWidth = size.Width;
_settingsService.AppSettings.StandardWindowHeight = size.Height;
}
}
}
@@ -189,6 +189,7 @@ namespace BetterLyrics.WinUI3.Views
ViewModel.IsImmersiveMode = true;
break;
case AppWindowPresenterKind.FullScreen:
AOTFlyoutItem.Visibility =
ClickThroughButton.Visibility =
DesktopFlyoutItem.Visibility =
@@ -196,6 +197,7 @@ namespace BetterLyrics.WinUI3.Views
DockFlyoutItem.Visibility =
Visibility.Collapsed;
FullScreenFlyoutItem.IsChecked = true;
ViewModel.IsImmersiveMode = true;
break;
case AppWindowPresenterKind.Overlapped:
DockFlyoutItem.Visibility = Visibility.Visible;
@@ -242,7 +244,7 @@ namespace BetterLyrics.WinUI3.Views
ClickThroughButton.Visibility = Visibility.Collapsed;
AOTFlyoutItem.IsChecked = overlappedPresenter.IsAlwaysOnTop;
ViewModel.IsImmersiveMode = _settingsService.IsImmersiveMode;
ViewModel.IsImmersiveMode = _settingsService.AppSettings.IsImmersiveMode;
}
break;
default:

View File

@@ -1225,7 +1225,7 @@
<Button x:Uid="SettingsPageImportSettingsButton" Command="{x:Bind ViewModel.ImportSettingsCommand}" />
<Button x:Uid="SettingsPageExportSettingsButton" Command="{x:Bind ViewModel.ExportSettingsCommand}" />
</StackPanel>
<controls:SettingsExpander.Items>
<controls:SettingsExpander.ItemsHeader>
<InfoBar
x:Uid="SettingsPageImportSettingsInfo"
BorderThickness="0"
@@ -1233,7 +1233,7 @@
IsClosable="False"
IsOpen="True"
Severity="Warning" />
</controls:SettingsExpander.Items>
</controls:SettingsExpander.ItemsHeader>
</controls:SettingsExpander>
<controls:SettingsCard x:Uid="SettingsPageDebugOverlay">