From dda1576ccd2884935318985a3467fa1befc89f91 Mon Sep 17 00:00:00 2001 From: Baka632 Date: Wed, 1 May 2024 11:28:24 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=B8=BA=E6=A6=82=E8=A7=88=E9=A1=B5?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=B6=E4=BB=96=E8=AF=AD=E8=A8=80=E5=89=A7?= =?UTF-8?q?=E6=83=85=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ViewModels/StoryGlanceViewModel.cs | 32 +++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/src/ViewModels/StoryGlanceViewModel.cs b/src/ViewModels/StoryGlanceViewModel.cs index 93023cf..4712172 100644 --- a/src/ViewModels/StoryGlanceViewModel.cs +++ b/src/ViewModels/StoryGlanceViewModel.cs @@ -10,6 +10,7 @@ public sealed partial class StoryGlanceViewModel : ObservableObject { private readonly StoryMetadataService metadataService = new(); private StorageFolder storyTextFolder = null; + private readonly List interludeTextList = ["幕间", "Interlude", "幕間", "브릿지"]; [ObservableProperty] private bool _isLoading = false; @@ -72,22 +73,37 @@ private async Task OpenGameDataFolder() strParts.Add(data.StoryName); - if (data.AvgTag != "幕间") + if (interludeTextList.Contains(data.AvgTag) != true) { + strParts.Add("-"); strParts.Add(data.AvgTag); } string storyDisplayName = string.Join(' ', strParts); string storyDescription = string.Empty; - string path = $"{data.StoryInfo.Replace('/', Path.DirectorySeparatorChar).Replace($"info{Path.DirectorySeparatorChar}", $"[uc]info{Path.DirectorySeparatorChar}")}.txt"; - - StorageFile storyDescFile = await GetStorageFileByPath(path, storyInfoFolder); - - if (storyDescFile != null) + if (data.StoryInfo is not null) + { + string path = $"{data.StoryInfo.Replace('/', Path.DirectorySeparatorChar).Replace($"info{Path.DirectorySeparatorChar}", $"[uc]info{Path.DirectorySeparatorChar}")}.txt"; + + try + { + StorageFile storyDescFile = await GetStorageFileByPath(path, storyInfoFolder); + + if (storyDescFile != null) + { + FileNameLoading = storyDescFile.Name; + storyDescription = await FileIO.ReadTextAsync(storyDescFile); + } + } + catch (FileNotFoundException) + { + storyDescription = "<空>"; + } + } + else { - FileNameLoading = storyDescFile.Name; - storyDescription = await FileIO.ReadTextAsync(storyDescFile); + storyDescription = "<空>"; } StoryInfo storyInfo = new(storyDisplayName, string.Empty, storyDescription, null, info, data); From dd7c72cb0f6c1b76970977e1d0d25a40ed037e38 Mon Sep 17 00:00:00 2001 From: Baka632 Date: Thu, 2 May 2024 18:35:01 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E5=8C=96=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Package.appxmanifest | 2 +- src/Services/StoryReader.cs | 2 +- src/Strings/en-US/Resources.resw | 6 ++++++ src/Strings/zh-CN/Resources.resw | 6 ++++++ src/ViewModels/StoryGlanceViewModel.cs | 4 ++-- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Package.appxmanifest b/src/Package.appxmanifest index 04a63b4..331e27d 100644 --- a/src/Package.appxmanifest +++ b/src/Package.appxmanifest @@ -9,7 +9,7 @@ + Version="4.6.0.1" /> diff --git a/src/Services/StoryReader.cs b/src/Services/StoryReader.cs index cb42731..8c8ae88 100644 --- a/src/Services/StoryReader.cs +++ b/src/Services/StoryReader.cs @@ -897,7 +897,7 @@ void InitCurrentKeys(out List currentKey, string[] options, string[] ref } #endregion return new NoOperationCommand(); - //throw new ArgumentException($@"无法分析参数""{nameof(strToAnalyse)}"",原始文件行:第{textLine}行,原始文本:""{strToAnalyse}"""); + //throw new ArgumentException($@"无法分析参数""{nameof(strToAnalyse)}"",原始文本:""{strToAnalyse}"""); } /// diff --git a/src/Strings/en-US/Resources.resw b/src/Strings/en-US/Resources.resw index 2c24092..f14bcad 100644 --- a/src/Strings/en-US/Resources.resw +++ b/src/Strings/en-US/Resources.resw @@ -237,4 +237,10 @@ Remove this story file + + <Story description not found> + + + <Empty> + \ No newline at end of file diff --git a/src/Strings/zh-CN/Resources.resw b/src/Strings/zh-CN/Resources.resw index c8c3ecc..c1172b9 100644 --- a/src/Strings/zh-CN/Resources.resw +++ b/src/Strings/zh-CN/Resources.resw @@ -246,4 +246,10 @@ 移除此剧情文件 + + <找不到剧情简介> + + + <空> + \ No newline at end of file diff --git a/src/ViewModels/StoryGlanceViewModel.cs b/src/ViewModels/StoryGlanceViewModel.cs index 4712172..dbc9023 100644 --- a/src/ViewModels/StoryGlanceViewModel.cs +++ b/src/ViewModels/StoryGlanceViewModel.cs @@ -98,12 +98,12 @@ private async Task OpenGameDataFolder() } catch (FileNotFoundException) { - storyDescription = "<空>"; + storyDescription = "StoryDescriptionFileNotFound".GetLocalized(); } } else { - storyDescription = "<空>"; + storyDescription = "StoryDescriptionEmpty".GetLocalized(); } StoryInfo storyInfo = new(storyDisplayName, string.Empty, storyDescription, null, info, data); From 3bc0522d44351ff1ec708f2af7762f94619b657d Mon Sep 17 00:00:00 2001 From: Baka632 Date: Thu, 2 May 2024 23:17:26 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=A1=B5=EF=BC=9A=E5=A2=9E=E5=8A=A0=E5=88=87=E6=8D=A2=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E8=83=8C=E6=99=AF=E5=8A=9F=E8=83=BD=E5=8F=8A=E5=85=B3?= =?UTF-8?q?=E4=BA=8E=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.xaml | 2 + src/ArknightsStoryText.UWP.csproj | 18 +++- src/Assets/App-Logo/Dark-Mode.png | Bin 0 -> 18314 bytes src/Assets/App-Logo/Light-Mode.png | Bin 0 -> 18494 bytes src/CommonValues.cs | 15 ++- .../AppBackgroundModeToStringConverter.cs | 28 ++++++ src/Models/AppBackgroundMode.cs | 20 ++++ src/Strings/en-US/Resources.resw | 30 ++++++ src/Strings/zh-CN/Resources.resw | 30 ++++++ src/ViewModels/MainViewModel.cs | 9 ++ src/ViewModels/SettingsViewModel.cs | 68 +++++++++++++ src/ViewModels/StoryGlanceViewModel.cs | 7 ++ src/ViewModels/TextMergeViewModel.cs | 7 ++ src/ViewModels/TextReadViewModel.cs | 7 ++ src/Views/MainPage.xaml | 1 - src/Views/MainPage.xaml.cs | 51 ++++++++-- src/Views/SettingsDialog.xaml | 91 ++++++++++++++++++ src/Views/SettingsDialog.xaml.cs | 13 +++ src/Views/StoryGlancePage.xaml | 7 ++ src/Views/TextMergePage.xaml | 5 + src/Views/TextReadPage.xaml | 5 + 21 files changed, 401 insertions(+), 13 deletions(-) create mode 100644 src/Assets/App-Logo/Dark-Mode.png create mode 100644 src/Assets/App-Logo/Light-Mode.png create mode 100644 src/Helpers/Converter/AppBackgroundModeToStringConverter.cs create mode 100644 src/Models/AppBackgroundMode.cs create mode 100644 src/ViewModels/SettingsViewModel.cs create mode 100644 src/Views/SettingsDialog.xaml create mode 100644 src/Views/SettingsDialog.xaml.cs diff --git a/src/App.xaml b/src/App.xaml index 88b87d2..f2ad149 100644 --- a/src/App.xaml +++ b/src/App.xaml @@ -3,6 +3,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:contract5NotPresent="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,5)" + xmlns:converter="using:ArknightsStoryText.UWP.Helpers.Converter" xmlns:local="using:ArknightsStoryText.UWP"> @@ -10,5 +11,6 @@ + diff --git a/src/ArknightsStoryText.UWP.csproj b/src/ArknightsStoryText.UWP.csproj index c3910c4..a616a34 100644 --- a/src/ArknightsStoryText.UWP.csproj +++ b/src/ArknightsStoryText.UWP.csproj @@ -134,9 +134,11 @@ + + @@ -176,6 +178,7 @@ + @@ -184,6 +187,9 @@ + + SettingsDialog.xaml + StoryGlancePage.xaml @@ -200,6 +206,8 @@ + + @@ -267,6 +275,10 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -282,13 +294,13 @@ - 1.0.1 + 1.0.3 8.2.2 - 1.0.2 + 1.0.3 1.0.3 @@ -316,7 +328,7 @@ 4.2.0 - 8.0.1 + 8.0.3 diff --git a/src/Assets/App-Logo/Dark-Mode.png b/src/Assets/App-Logo/Dark-Mode.png new file mode 100644 index 0000000000000000000000000000000000000000..985372d31d821da70825e639417d364cfd0cedc4 GIT binary patch literal 18314 zcmeHvc{tQ-|8UFGsY9i6%25fYoJq|Tof4H$N|=%wGlMKcDoKniAzLR6CCf1yiZZ7f zG`6u6DNM9z5|e!=46-wpF=l)3?+o%@*Za@=$8$Z;@A`2u?)(0J_U-<PRFk|ir(;Ai`)*HU+sf!>mgiYTb z+pSo#WZC*Nr_lOf{m7A1*NL;2!B}4mtZ#Z1 zjE|!nB~Oo|#ZyygdQ1!e4His~p`E~rzIbJpf_P;P9eN7Bj?dv9M?)e(E2eV;^eiv1 zcuYJ#CVq5G45=?((HD;;M2;_jmyCbVlz`2%STL2)oTam1U4r}n{4_ATinPERTU|SY zb2qiSj=kV*;c&y!(ck83pdJ3N3vRa^Jc6%y-EqEg&($y7Juve6Euzou`+gxYfuRp? zg~byhABPbC3BCU`JeKlzTypdyY79B`!ISidPct4-GReu=PpB`Rro5!2J>zTXm+H^V+VaZ!uQg58^(}RcZH+A*E$vkv18Y+J$uyE4;(mrkhK8rkoI#__&8@6#Z7*E7eAU&}!`s{M z=FOmxkb9Al(XsLIWb(6T$;qjyG+Ith-Wxjo-MiAVGA6USzP`D+y}hfew|8J*WMq7t z!{PDnj9rTdoPTyTv~XXtWba$(XX%a$=bD!+IU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;XblCg*9eRHe+b5t{ z15n|N|A6uEs2*9-bR8x$Oz$wEdvmr52f|-F!rlZb{Y^S0zO$jwI&pS5+zfQyF)I9XV!YI6y@bKX1A;X@l%0k9rwm?h=Xp4Wcvr$2O?wZWuWsw&xdHnVGKb zD(s5CO-}K5v_(k#Q#s7GmrWk)e??w4VOO9eA=#xpwRT^1lD|`fOsim3Ta*NJNiuFU z@Nr9#^fR5Jj-R|wN)+GLGGan+c!ggrI?W#W5ML!0V14JK$1R!oN4*b@jpj;JeDD30 z{;~0SeZ{r+e|ple9n82pwac2kh2B9t}R}|Xor{1OlV+K&enPxfBxwR4Jo{d zBqHK`69Tx}m!4yMN4k?oy3bUPu9f82ABT8f5W)!t#+Os;@Jxu}@kUi8Pbi1{r?PsB zuJ=`0#tPcuW?hA4c--rWmufmwwqNs3w5=PF6rKN}7tH?qufQ!z_`l(zzLGFpT zPgMLhgZ-Ofp;OJ!Wpj6{vuh0QJQZwlQZ{DkXFLy9K3=IK6lH2wsSn?XM5J`AI;$bt zL+vYgyQbFLV@GqTaCf}2aiGZwYLh&cIl#AkW3QX1UI_=(|&C z3=`h^TQ81sY$jxgPj)a<{08?0Os8q|WXSQ)I%ch6e&**h`Ne^k-cTlezv~C?_1Tl1 zqa$i%3Ub>oW~@0dIZE)#5C44J9ox53R4)>Urd0w*N5T@ZeHHt96@7aMG+v?Z*s2J& zs~+)V=Lxus${&uqTqujvMQbbu!(uKhmV*DUO8D>jUmXkn|3}}YfNv{>h^`w6rI($b Tje&ntvcyRL^zjTm+gtw!{^alN literal 0 HcmV?d00001 diff --git a/src/Assets/App-Logo/Light-Mode.png b/src/Assets/App-Logo/Light-Mode.png new file mode 100644 index 0000000000000000000000000000000000000000..4e16171bd2bc79d095d30344c235e59c792ae809 GIT binary patch literal 18494 zcmeHvdpy(c`@ia4dZV{aqJtzYwIw=82U#UylFa5*&LR|{oSLnYgd)>W%8Hfd?2Y8O zoYIn3Bpqa8NY0zXX0!e7mrTBo-(TN9K9BG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dVuNjWqOR?6ub|XetmM4Qrt zazP^Gh!*kj7DjSu|G{!zhIv;rq1B7DDspJsTiSS%5LJP-E#HBkZRMQ)z-oq=>*PKn^dCVh>&4 zbh}0mE^A`YV0oG{*PKIR&Kc%nVJ;Q?w=&^><`;O(`lTQ}?&W=TLW1p=^Iv*O>Y-nv PB4Ma^;%L?p`)mIX@uNFQ literal 0 HcmV?d00001 diff --git a/src/CommonValues.cs b/src/CommonValues.cs index 11b110b..19ec068 100644 --- a/src/CommonValues.cs +++ b/src/CommonValues.cs @@ -1,8 +1,21 @@ -namespace ArknightsStoryText.UWP; +using Windows.ApplicationModel; + +namespace ArknightsStoryText.UWP; internal static class CommonValues { public const string NotifyUpdateStoriesMessageToken = "Notify_UpdateStories_MessageToken"; public const string NotifyUpdateStoryFileInfosMessageToken = "Notify_UpdateStoryFileInfos_MessageToken"; public const string NotifyPivotNavigationMessageToken = "Notify_PivotNavigation_MessageToken"; + public const string AppBackgroundModeSettingsKey = "App_BackgroundMode_SettingsKey"; + public const string NotifyAppBackgroundChangedMessageToken = "Notify_AppBackgroundChanged_MessageToken"; + + /// + /// 获取应用程序版本 + /// + public static string AppVersion => $"{Package.Current.Id.Version.Major}.{Package.Current.Id.Version.Minor}.{Package.Current.Id.Version.Build}.{Package.Current.Id.Version.Revision}"; + /// + /// 获取带“版本”文字的应用程序版本字符串 + /// + public static string AppVersionWithText => string.Format("AppVersion_WithPlaceholder".GetLocalized(), AppVersion); } diff --git a/src/Helpers/Converter/AppBackgroundModeToStringConverter.cs b/src/Helpers/Converter/AppBackgroundModeToStringConverter.cs new file mode 100644 index 0000000..d51488c --- /dev/null +++ b/src/Helpers/Converter/AppBackgroundModeToStringConverter.cs @@ -0,0 +1,28 @@ + +using Windows.UI.Xaml.Data; + +namespace ArknightsStoryText.UWP.Helpers.Converter; + +public sealed class AppBackgroundModeToStringConverter : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, string language) + { + if (value is AppBackgroundMode mode) + { + return mode switch + { + AppBackgroundMode.Mica => "MicaBackground".GetLocalized(), + AppBackgroundMode.Acrylic => "AcrylicBackground".GetLocalized(), + AppBackgroundMode.PureColor => "PureColorBackground".GetLocalized(), + _ => throw new NotImplementedException() + }; + } + + return DependencyProperty.UnsetValue; + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) + { + throw new NotImplementedException(); + } +} diff --git a/src/Models/AppBackgroundMode.cs b/src/Models/AppBackgroundMode.cs new file mode 100644 index 0000000..3c85b5d --- /dev/null +++ b/src/Models/AppBackgroundMode.cs @@ -0,0 +1,20 @@ +namespace ArknightsStoryText.UWP.Models; + +/// +/// 应用背景模式的枚举 +/// +public enum AppBackgroundMode +{ + /// + /// 纯色背景 + /// + PureColor, + /// + /// 亚克力背景 + /// + Acrylic, + /// + /// 云母背景 + /// + Mica +} diff --git a/src/Strings/en-US/Resources.resw b/src/Strings/en-US/Resources.resw index f14bcad..255cd15 100644 --- a/src/Strings/en-US/Resources.resw +++ b/src/Strings/en-US/Resources.resw @@ -243,4 +243,34 @@ <Empty> + + Settings + + + Close + + + Settings + + + About + + + Version: {0} + + + Repo address + + + App background + + + Mica + + + Acrylic + + + Plain color + \ No newline at end of file diff --git a/src/Strings/zh-CN/Resources.resw b/src/Strings/zh-CN/Resources.resw index c1172b9..d841cbe 100644 --- a/src/Strings/zh-CN/Resources.resw +++ b/src/Strings/zh-CN/Resources.resw @@ -252,4 +252,34 @@ <空> + + 设置 + + + 关闭 + + + 设置 + + + 关于 + + + 版本:{0} + + + 仓库地址 + + + 应用背景 + + + 云母 + + + 亚克力 + + + 纯色 + \ No newline at end of file diff --git a/src/ViewModels/MainViewModel.cs b/src/ViewModels/MainViewModel.cs index deeb6d9..595e01e 100644 --- a/src/ViewModels/MainViewModel.cs +++ b/src/ViewModels/MainViewModel.cs @@ -16,10 +16,19 @@ protected override void OnActivated() { base.OnActivated(); WeakReferenceMessenger.Default.Register(this, CommonValues.NotifyPivotNavigationMessageToken, OnPivotNavigationRequested); + WeakReferenceMessenger.Default.Register(this, CommonValues.NotifyAppBackgroundChangedMessageToken, OnAppBackgroundChanged); } private void OnPivotNavigationRequested(object recipient, PivotItemIdentifier message) { View.MainPagePivot.SelectedIndex = (int)message.Index; } + + private void OnAppBackgroundChanged(object recipient, string message) + { + if (Enum.TryParse(message, out AppBackgroundMode mode)) + { + View.SetMainPageBackground(mode); + } + } } \ No newline at end of file diff --git a/src/ViewModels/SettingsViewModel.cs b/src/ViewModels/SettingsViewModel.cs new file mode 100644 index 0000000..b624cfe --- /dev/null +++ b/src/ViewModels/SettingsViewModel.cs @@ -0,0 +1,68 @@ +using CommunityToolkit.Mvvm.Messaging; + +namespace ArknightsStoryText.UWP.ViewModels; + +public sealed partial class SettingsViewModel : ObservableObject +{ + public readonly IReadOnlyList AppBackgroundModes; + + [ObservableProperty] + private int selectedAppBackgroundModeIndex; + + public SettingsViewModel() + { + List bgModes = new(3); + + bool isSupportMica = MicaHelper.IsSupported(); + bool isSupportAcrylic = AcrylicHelper.IsSupported(); + + if (isSupportMica) + { + bgModes.Add(AppBackgroundMode.Mica); + } + + if (isSupportAcrylic) + { + bgModes.Add(AppBackgroundMode.Acrylic); + } + + // 不管什么情况,系统一定支持纯色背景显示 + bgModes.Add(AppBackgroundMode.PureColor); + + AppBackgroundModes = bgModes; + + if (SettingsHelper.TryGet(CommonValues.AppBackgroundModeSettingsKey, out string bgModeString) && Enum.TryParse(bgModeString, out AppBackgroundMode backgroundMode)) + { + // ;-) + } + else + { + if (isSupportMica) + { + backgroundMode = AppBackgroundMode.Mica; + } + else if (isSupportAcrylic) + { + backgroundMode = AppBackgroundMode.Acrylic; + } + else + { + backgroundMode = AppBackgroundMode.PureColor; + } + } + + selectedAppBackgroundModeIndex = bgModes.IndexOf(backgroundMode); + } + + partial void OnSelectedAppBackgroundModeIndexChanged(int value) + { + if (value >= 0) + { + AppBackgroundMode bgMode = AppBackgroundModes[value]; + string bgModeString = bgMode.ToString(); + SettingsHelper.Set(CommonValues.AppBackgroundModeSettingsKey, bgModeString); + + WeakReferenceMessenger.Default.Send(bgModeString, CommonValues.NotifyAppBackgroundChangedMessageToken); + } + } +} \ No newline at end of file diff --git a/src/ViewModels/StoryGlanceViewModel.cs b/src/ViewModels/StoryGlanceViewModel.cs index dbc9023..8a44709 100644 --- a/src/ViewModels/StoryGlanceViewModel.cs +++ b/src/ViewModels/StoryGlanceViewModel.cs @@ -214,6 +214,13 @@ private async Task GoToStoryMergePage(object obj) WeakReferenceMessenger.Default.Send(targetPageIdentifier, CommonValues.NotifyPivotNavigationMessageToken); } + [RelayCommand] + private static async Task OpenSettingDialog() + { + SettingsDialog dialog = new(); + await dialog.ShowAsync(); + } + private static async Task GetStorageFileByPath(string path, StorageFolder baseFolder) { string[] pathParts = path.Split(Path.DirectorySeparatorChar); diff --git a/src/ViewModels/TextMergeViewModel.cs b/src/ViewModels/TextMergeViewModel.cs index 595a32e..ef9ac85 100644 --- a/src/ViewModels/TextMergeViewModel.cs +++ b/src/ViewModels/TextMergeViewModel.cs @@ -293,6 +293,13 @@ private void RemoveStoryTextFile(object obj) } } + [RelayCommand] + private static async Task OpenSettingDialog() + { + SettingsDialog dialog = new(); + await dialog.ShowAsync(); + } + public static string GetStoryDisplayName(InfoUnlockData info) { string storyDisplayName; diff --git a/src/ViewModels/TextReadViewModel.cs b/src/ViewModels/TextReadViewModel.cs index c00d320..08e39ed 100644 --- a/src/ViewModels/TextReadViewModel.cs +++ b/src/ViewModels/TextReadViewModel.cs @@ -187,6 +187,13 @@ private void ClearStoryTexts() IsLoading = false; } + [RelayCommand] + private static async Task OpenSettingDialog() + { + SettingsDialog dialog = new(); + await dialog.ShowAsync(); + } + public async Task ReParseStoryTextAsync() { IsLoading = true; diff --git a/src/Views/MainPage.xaml b/src/Views/MainPage.xaml index f2725c6..c2ee6b1 100644 --- a/src/Views/MainPage.xaml +++ b/src/Views/MainPage.xaml @@ -7,7 +7,6 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:viewmodels="using:ArknightsStoryText.UWP.ViewModels" d:DataContext="{d:DesignInstance Type=viewmodels:MainViewModel}" - Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" mc:Ignorable="d"> diff --git a/src/Views/MainPage.xaml.cs b/src/Views/MainPage.xaml.cs index 47e947a..e3823b4 100644 --- a/src/Views/MainPage.xaml.cs +++ b/src/Views/MainPage.xaml.cs @@ -13,14 +13,7 @@ public MainPage() { this.InitializeComponent(); - if (MicaHelper.IsSupported()) - { - MicaHelper.TrySetMica(this); - } - else if (AcrylicHelper.IsSupported()) - { - AcrylicHelper.TrySetAcrylicBrush(this); - } + AutoSetMainPageBackground(); if (EnvironmentHelper.IsWindowsMobile) { @@ -33,4 +26,46 @@ public MainPage() ViewModel = new(this); } + + private void AutoSetMainPageBackground() + { + if (SettingsHelper.TryGet(CommonValues.AppBackgroundModeSettingsKey, out string modeString) && Enum.TryParse(modeString, out AppBackgroundMode mode)) + { + // :D + } + else + { + if (MicaHelper.IsSupported()) + { + mode = AppBackgroundMode.Mica; + } + else if (AcrylicHelper.IsSupported()) + { + mode = AppBackgroundMode.Acrylic; + } + else + { + mode = AppBackgroundMode.PureColor; + } + } + + SetMainPageBackground(mode); + } + + public bool SetMainPageBackground(AppBackgroundMode mode) + { + switch (mode) + { + case AppBackgroundMode.Acrylic: + return AcrylicHelper.TrySetAcrylicBrush(this); + case AppBackgroundMode.Mica: + // 设置 Mica 时,要将控件背景设置为透明 + Background = new SolidColorBrush(Colors.Transparent); + return MicaHelper.TrySetMica(this); + case AppBackgroundMode.PureColor: + default: + Background = Resources["ApplicationPageBackgroundThemeBrush"] as Brush; + return true; + } + } } diff --git a/src/Views/SettingsDialog.xaml b/src/Views/SettingsDialog.xaml new file mode 100644 index 0000000..32c420c --- /dev/null +++ b/src/Views/SettingsDialog.xaml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Views/SettingsDialog.xaml.cs b/src/Views/SettingsDialog.xaml.cs new file mode 100644 index 0000000..c1022d5 --- /dev/null +++ b/src/Views/SettingsDialog.xaml.cs @@ -0,0 +1,13 @@ +// https://go.microsoft.com/fwlink/?LinkId=234238 上介绍了“内容对话框”项模板 + +namespace ArknightsStoryText.UWP.Views; + +public sealed partial class SettingsDialog : ContentDialog +{ + public SettingsViewModel ViewModel { get; } = new SettingsViewModel(); + + public SettingsDialog() + { + this.InitializeComponent(); + } +} diff --git a/src/Views/StoryGlancePage.xaml b/src/Views/StoryGlancePage.xaml index e3ebcef..323161a 100644 --- a/src/Views/StoryGlancePage.xaml +++ b/src/Views/StoryGlancePage.xaml @@ -44,6 +44,13 @@ x:Uid="OpenGameDataFolder" Command="{x:Bind ViewModel.OpenGameDataFolderCommand}" Icon="OpenLocal" /> + + + + + + diff --git a/src/Views/TextReadPage.xaml b/src/Views/TextReadPage.xaml index 33d7dcf..bddc69e 100644 --- a/src/Views/TextReadPage.xaml +++ b/src/Views/TextReadPage.xaml @@ -114,6 +114,11 @@ Command="{x:Bind ViewModel.ClearStoryTextsCommand}" Icon="Cancel" IsEnabled="{x:Bind helpers:XamlHelper.ReverseBoolean(ViewModel.IsLoading), Mode=OneWay}" /> + + From aaaa983ad61e53b8803b2e720e9459f22f5d18b1 Mon Sep 17 00:00:00 2001 From: Baka632 Date: Thu, 2 May 2024 23:48:24 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E5=A4=84=E7=90=86=E8=BF=87=E7=A8=8B=EF=BC=8C=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Package.appxmanifest | 2 +- src/ViewModels/TextReadViewModel.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Package.appxmanifest b/src/Package.appxmanifest index 331e27d..501c9c4 100644 --- a/src/Package.appxmanifest +++ b/src/Package.appxmanifest @@ -9,7 +9,7 @@ + Version="4.8.0.0" /> diff --git a/src/ViewModels/TextReadViewModel.cs b/src/ViewModels/TextReadViewModel.cs index 08e39ed..ad155bb 100644 --- a/src/ViewModels/TextReadViewModel.cs +++ b/src/ViewModels/TextReadViewModel.cs @@ -266,7 +266,7 @@ private async Task ParseOriginTextFromStorageFileAsync(StorageFile file) { scene = sr.GetStoryScene(); } - catch (ArgumentException) + catch (ArgumentException ex) when (ex is not ArgumentNullException) { string title = string.Format("TutorialFileNotSupported_WithPlaceholder".GetLocalized(), file.Name); string message = "OpenAnotherFileInstead".GetLocalized();