diff --git a/BackgroundTasks/BackgroundTasks.csproj b/BackgroundTasks/BackgroundTasks.csproj index 0eb5bf1..b6f7aa3 100644 --- a/BackgroundTasks/BackgroundTasks.csproj +++ b/BackgroundTasks/BackgroundTasks.csproj @@ -12,8 +12,8 @@ BackgroundTasks zh-CN UAP - 10.0.26100.0 - 10.0.15063.0 + 10.0.22621.0 + 10.0.16299.0 14 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} diff --git a/BackgroundTasks/TileFeedBackgroundTask.cs b/BackgroundTasks/TileFeedBackgroundTask.cs index 7ccd560..ca82eef 100644 --- a/BackgroundTasks/TileFeedBackgroundTask.cs +++ b/BackgroundTasks/TileFeedBackgroundTask.cs @@ -1,7 +1,6 @@ using System.Diagnostics; using TrueLove.Lib.Notification; using Windows.ApplicationModel.Background; -using Windows.UI.Notifications; namespace BackgroundTasks { @@ -16,7 +15,6 @@ public void Run(IBackgroundTaskInstance taskInstance) BackgroundTaskDeferral deferral = taskInstance.GetDeferral(); Assembly.Tile(); // 组装动态磁贴 - TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true); // Inform the system that the task is finished. deferral.Complete(); diff --git a/README.md b/README.md index 84890cf..955512b 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The building of the project was in progress... - [Windows10 OS](https://www.microsoft.com/en-us/software-download/windows10) (ARM) : Windows 10 Creators Update (10.0; version 15063) or higher - >= Windows 1703 - [Visual Studio](https://visualstudio.microsoft.com/downloads/) with UWP : Version 2017 or higher -- [SDK](https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/) : Windows 11 SDK (10.0.26100.0) +- [SDK](https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/) : Windows 11 SDK (10.0.22621.0) - Can be installed in the Visual Studio Installer as well. ### Installation diff --git a/TrueLove.Lib/Models/Code/CommentCollection.cs b/TrueLove.Lib/Models/Code/CommentCollection.cs index b05ba13..e719a64 100644 --- a/TrueLove.Lib/Models/Code/CommentCollection.cs +++ b/TrueLove.Lib/Models/Code/CommentCollection.cs @@ -25,7 +25,7 @@ public class CommentCollection : ObservableCollection, ISupportIncr public async void LoadMoreItemsManually() { CommentParser commentParser = new(); - commentParser.ParseCommentWithNetwork(++_pageNumber); + commentParser.ForegroundParseComment(++_pageNumber); for (int element = 1; element <= 50; element++) { var latestItem = await commentParser.Append(element); @@ -38,7 +38,7 @@ public async Task LoadMoreItemsManuallyAsync() try { CommentParser commentParser = new(); - commentParser.ParseCommentWithNetwork(++_pageNumber); + commentParser.ForegroundParseComment(++_pageNumber); for (int element = 1; element <= 99; element++) { var latestItem = await commentParser.Append(element); @@ -74,7 +74,7 @@ public void Load5ItemsRandomly() { List list = []; CommentParser commentParser = new(); - commentParser.ParseComment(); + commentParser.BackgroundParseComment(++_pageNumber); for (int j = 1; j <= 5; j++) { Random random = new(); @@ -109,7 +109,7 @@ async Task LoadMoreItemsAsyncCore(CancellationToken cancel, { // 向集合中添加指定项 CommentParser commentParser = new(); - commentParser.ParseComment(); + commentParser.BackgroundParseComment(++_pageNumber); var latestItem = await commentParser.Append(1); Add(latestItem); } diff --git a/TrueLove.Lib/Models/Code/ImageCollection.cs b/TrueLove.Lib/Models/Code/ImageCollection.cs index 9e67ede..8680db7 100644 --- a/TrueLove.Lib/Models/Code/ImageCollection.cs +++ b/TrueLove.Lib/Models/Code/ImageCollection.cs @@ -18,7 +18,7 @@ public class ImageCollection : ObservableCollection, ISupportIncremental public async void LoadMoreItemsManually() { ImageParser imageParser = new(); - imageParser.ParseImageWithNetwork(++_pageNumber); + imageParser.ForegroundParseImage(++_pageNumber); for (int element = 1; element <= 50; element++) { var latestItem = await imageParser.Append(element); @@ -31,7 +31,7 @@ public async Task LoadMoreItemsManuallyAsync() try { ImageParser imageParser = new(); - imageParser.ParseImageWithNetwork(++_pageNumber); + imageParser.ForegroundParseImage(++_pageNumber); for (int element = 1; element <= 99; element++) { var latestItem = await imageParser.Append(element); @@ -66,7 +66,7 @@ public void Load9ItemsRandomly() { List list = []; ImageParser imageParser = new(); - imageParser.ParseImage(); + imageParser.BackgroundParseImage(++_pageNumber); for (int j = 0; j < 9; j++) { Random random = new(); @@ -100,7 +100,7 @@ async Task LoadMoreItemsAsyncCore(CancellationToken cancel, else { ImageParser imageParser = new(); - imageParser.ParseImage(); + imageParser.BackgroundParseImage(++_pageNumber); var latestItem = await imageParser.Append(1); Add(latestItem); } diff --git a/TrueLove.Lib/Models/Enum/DialogType.cs b/TrueLove.Lib/Models/Enum/DialogType.cs index 773d9dd..1cc49f6 100644 --- a/TrueLove.Lib/Models/Enum/DialogType.cs +++ b/TrueLove.Lib/Models/Enum/DialogType.cs @@ -3,6 +3,5 @@ public enum DialogType { CommentCreate, - ReleaseNotes, } } diff --git a/TrueLove.Lib/Notification/Assembly.cs b/TrueLove.Lib/Notification/Assembly.cs index 55534c6..3aa6dc9 100644 --- a/TrueLove.Lib/Notification/Assembly.cs +++ b/TrueLove.Lib/Notification/Assembly.cs @@ -36,13 +36,6 @@ public static async void Dialog(DialogType name) dialogCreate.BorderBrush = (Brush)Application.Current.Resources["SystemControlBackgroundListMediumRevealBorderBrush"]; } break; - - case DialogType.ReleaseNotes: - dialogCreate.Title = "Release Notes"; - dialogCreate.CloseButtonText = "Okay"; - dialogCreate.Content = new Template.ContentDialog.ReleaseNotes(); - dialogCreate.Background = new SolidColorBrush(Colors.Black); - break; } try { @@ -57,6 +50,7 @@ public static void Tile() // Create a tile update manager for the specified syndication feed. var updater = TileUpdateManager.CreateTileUpdaterForApplication(); updater.Clear(); + updater.EnableNotificationQueue(true); CommentCollection commentCollection = []; commentCollection.Load5ItemsRandomly(); diff --git a/TrueLove.Lib/Notification/Template/ContentDialog/ReleaseNotes.xaml b/TrueLove.Lib/Notification/Template/ContentDialog/ReleaseNotes.xaml deleted file mode 100644 index 7471a3b..0000000 --- a/TrueLove.Lib/Notification/Template/ContentDialog/ReleaseNotes.xaml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - 🔧 解决物理内存使用翻倍问题 - 🔧 解决界面处于宽屏下右滑滑出空白汉堡菜单问题 - 🔧 解决工具栏走位问题 - 🔧 解决打开应用围绕一圈白线问题 - 🔧 删除不能正确工作的快捷键 - - - - - 🛠 提示网络错误 - 🔨 深灰色夜间主题 - 🛠 响应鼠标返回键 - 🔨 New Logo - - - - - 🔨 增加了底部工具栏,带有刷新网页,回到顶部的功能,并具备出色的动画 - 🛠 可以滑出滑入汉堡菜单 - 🛠 重写了主页、设置 UI - 🔨 支援 WP - - - - - 🔨 更换 FontIcon 矢量图标 - 🛠 更具有人性化的导航栏 - 🛠 返回导航功能已生效 - - - - diff --git a/TrueLove.Lib/Notification/Template/ContentDialog/ReleaseNotes.xaml.cs b/TrueLove.Lib/Notification/Template/ContentDialog/ReleaseNotes.xaml.cs deleted file mode 100644 index 052a3fc..0000000 --- a/TrueLove.Lib/Notification/Template/ContentDialog/ReleaseNotes.xaml.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Windows.UI.Xaml.Controls; - -// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 - -namespace TrueLove.Lib.Notification.Template.ContentDialog -{ - /// - /// An empty page that can be used on its own or navigated to within a Frame. - /// - public sealed partial class ReleaseNotes : Page - { - public ReleaseNotes() - { - this.InitializeComponent(); - } - } -} diff --git a/TrueLove.Lib/Notification/Template/Toast.cs b/TrueLove.Lib/Notification/Template/Toast.cs index 207e631..eb5010a 100644 --- a/TrueLove.Lib/Notification/Template/Toast.cs +++ b/TrueLove.Lib/Notification/Template/Toast.cs @@ -7,7 +7,7 @@ class Toast public static ToastContent CheckNetwork() => new ToastContentBuilder() .AddArgument("conversationId", 98143) .AddText("No Internet Connection") - .AddText("Loading local data.") + .AddText("Loading local data...") .AddButton(new ToastButton() .SetContent("Settings") .AddArgument("action", "settings") diff --git a/TrueLove.Lib/Spider/CommentParser.cs b/TrueLove.Lib/Spider/CommentParser.cs index 4e571d3..af4e66f 100644 --- a/TrueLove.Lib/Spider/CommentParser.cs +++ b/TrueLove.Lib/Spider/CommentParser.cs @@ -13,14 +13,16 @@ public class CommentParser { string _src; - public void ParseComment() + public void BackgroundParseComment(int _pageNumber) { var doctypeGenerator = new DoctypeGenerator(); _src = doctypeGenerator.GetSourceCode(ApplicationData.Current.LocalFolder.Path + @"\Comment.html"); Debug.WriteLine(ApplicationData.Current.LocalFolder.Path + @"\Comment.html"); + if (NetworkHelper.Instance.ConnectionInformation.IsInternetAvailable) + _ = doctypeGenerator.SaveSourceCodeAsync($"https://avicii.com/page/{_pageNumber}", "comment"); } - public async void ParseCommentWithNetwork(int _pageNumber) + public async void ForegroundParseComment(int _pageNumber) { var doctypeGenerator = new DoctypeGenerator(); _src = doctypeGenerator.GetSourceCode(ApplicationData.Current.LocalFolder.Path + @"\Comment.html"); diff --git a/TrueLove.Lib/Spider/DoctypeGenerator.cs b/TrueLove.Lib/Spider/DoctypeGenerator.cs index 5966aee..dced889 100644 --- a/TrueLove.Lib/Spider/DoctypeGenerator.cs +++ b/TrueLove.Lib/Spider/DoctypeGenerator.cs @@ -1,7 +1,6 @@ using System; using System.IO; using System.Net.Http; -using System.Text.RegularExpressions; using System.Threading.Tasks; using Windows.Storage; @@ -9,12 +8,7 @@ namespace TrueLove.Lib.Spider { public class DoctypeGenerator { - public string GetSourceCode(string path) - { - sourceCode = File.ReadAllText(path); - //TimeToNow(); - return sourceCode; - } + public string GetSourceCode(string path) => File.ReadAllText(path); /// /// @@ -22,15 +16,17 @@ public string GetSourceCode(string path) /// Use URL address public async Task SaveSourceCodeAsync(string path, string page) { + string sourceCode = null; using var httpClient = new HttpClient(); - try - { - sourceCode = await httpClient.GetStringAsync(new Uri(path)); - } - catch (HttpRequestException) + do { - sourceCode = await httpClient.GetStringAsync(new Uri(path)); + try + { + sourceCode = await httpClient.GetStringAsync(new Uri(path)); + } + catch (HttpRequestException) { } } + while (sourceCode == null); var localFolder = ApplicationData.Current.LocalFolder; if (page == "comment") { @@ -46,16 +42,5 @@ public async Task SaveSourceCodeAsync(string path, string page) } return sourceCode; } - - public void TimeToNow() - { - var pattern = @"\d+-\d+-\d+"; - var now = DateTime.Now; - var input = now.ToString("yyyy-MM-dd"); - Regex regex = new Regex(pattern); - sourceCode = regex.Replace(sourceCode, input); - } - - internal string sourceCode; } } diff --git a/TrueLove.Lib/Spider/ImageParser.cs b/TrueLove.Lib/Spider/ImageParser.cs index f19c8c1..16d2874 100644 --- a/TrueLove.Lib/Spider/ImageParser.cs +++ b/TrueLove.Lib/Spider/ImageParser.cs @@ -10,14 +10,16 @@ internal class ImageParser { string _src; - public void ParseImage() + public void BackgroundParseImage(int _pageNumber) { var doctypeGenerator = new DoctypeGenerator(); _src = doctypeGenerator.GetSourceCode(ApplicationData.Current.LocalFolder.Path + @"\Image.html"); Debug.WriteLine(ApplicationData.Current.LocalFolder.Path + @"\Image.html"); + if (NetworkHelper.Instance.ConnectionInformation.IsInternetAvailable) + _ = doctypeGenerator.SaveSourceCodeAsync($"https://avicii.com/images/page/{_pageNumber}", "image"); } - public async void ParseImageWithNetwork(int _pageNumber) + public async void ForegroundParseImage(int _pageNumber) { var doctypeGenerator = new DoctypeGenerator(); _src = doctypeGenerator.GetSourceCode(ApplicationData.Current.LocalFolder.Path + @"\Image.html"); diff --git a/TrueLove.Lib/TrueLove.Lib.csproj b/TrueLove.Lib/TrueLove.Lib.csproj index 09621fe..ac0be96 100644 --- a/TrueLove.Lib/TrueLove.Lib.csproj +++ b/TrueLove.Lib/TrueLove.Lib.csproj @@ -12,8 +12,8 @@ TrueLove.Lib zh-CN UAP - 10.0.26100.0 - 10.0.15063.0 + 10.0.22621.0 + 10.0.16299.0 14 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} @@ -133,9 +133,6 @@ CommentCreate.xaml - - ReleaseNotes.xaml - @@ -167,10 +164,6 @@ MSBuild:Compile Designer - - MSBuild:Compile - Designer - 14.0 diff --git a/TrueLove.UWP/App.xaml.cs b/TrueLove.UWP/App.xaml.cs index c0b8051..6041756 100644 --- a/TrueLove.UWP/App.xaml.cs +++ b/TrueLove.UWP/App.xaml.cs @@ -1,17 +1,10 @@ using Microsoft.QueryStringDotNET; using System; -using System.IO; using System.Threading.Tasks; -using TrueLove.Lib.Helpers; -using TrueLove.Lib.Models.Enum; using TrueLove.UWP.Views; using Windows.ApplicationModel; using Windows.ApplicationModel.Activation; -using Windows.ApplicationModel.Core; -using Windows.Storage; -using Windows.UI; using Windows.UI.Notifications; -using Windows.UI.ViewManagement; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Navigation; @@ -91,11 +84,13 @@ protected override async void OnActivated(IActivatedEventArgs e) Window.Current.Content = root; } if (root.Content == null) - { + { bool loadState = e.PreviousExecutionState == ApplicationExecutionState.Terminated; ExtendedSplash extendedSplash = new(e.SplashScreen, loadState); - root = new Frame(); - root.Content = extendedSplash; + root = new Frame + { + Content = extendedSplash + }; Window.Current.Content = root; await Task.Delay(50); // 防止初始屏幕闪烁 } diff --git a/TrueLove.UWP/Assets/Fonts/iconfont.ttf b/TrueLove.UWP/Assets/Fonts/iconfont.ttf index 62aefd4..b8621a1 100644 Binary files a/TrueLove.UWP/Assets/Fonts/iconfont.ttf and b/TrueLove.UWP/Assets/Fonts/iconfont.ttf differ diff --git a/TrueLove.UWP/Package.appxmanifest b/TrueLove.UWP/Package.appxmanifest index e87b86d..d6e0bc5 100644 --- a/TrueLove.UWP/Package.appxmanifest +++ b/TrueLove.UWP/Package.appxmanifest @@ -1,6 +1,6 @@  - + Avicii.UWP diff --git a/TrueLove.UWP/Template/Button.xaml b/TrueLove.UWP/Template/Button.xaml index 77b2e3f..74d8d16 100644 --- a/TrueLove.UWP/Template/Button.xaml +++ b/TrueLove.UWP/Template/Button.xaml @@ -530,7 +530,6 @@ VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" AutomationProperties.AccessibilityView="Raw" Background="{TemplateBinding Background}" - BackgroundSizing="{TemplateBinding BackgroundSizing}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Content="{TemplateBinding Content}" diff --git a/TrueLove.UWP/TrueLove.UWP.csproj b/TrueLove.UWP/TrueLove.UWP.csproj index baf4f4b..c6ff9d5 100644 --- a/TrueLove.UWP/TrueLove.UWP.csproj +++ b/TrueLove.UWP/TrueLove.UWP.csproj @@ -12,8 +12,8 @@ TrueLove en UAP - 10.0.26100.0 - 10.0.15063.0 + 10.0.22621.0 + 10.0.16299.0 14 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} @@ -332,7 +332,7 @@ - + Windows Mobile Extensions for the UWP diff --git a/TrueLove.UWP/TrueLove.UWP_TemporaryKey.pfx b/TrueLove.UWP/TrueLove.UWP_TemporaryKey.pfx index 1d28ff4..94972ea 100644 Binary files a/TrueLove.UWP/TrueLove.UWP_TemporaryKey.pfx and b/TrueLove.UWP/TrueLove.UWP_TemporaryKey.pfx differ diff --git a/TrueLove.UWP/Views/CommentsPage.xaml b/TrueLove.UWP/Views/CommentsPage.xaml index 381c93f..990ac89 100644 --- a/TrueLove.UWP/Views/CommentsPage.xaml +++ b/TrueLove.UWP/Views/CommentsPage.xaml @@ -5,14 +5,14 @@ xmlns:animations="using:Microsoft.Toolkit.Uwp.UI.Animations" xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:date="using:TrueLove.Lib.Models.Code" + xmlns:data="using:TrueLove.Lib.Models.Code" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - d:DataContext="{d:DesignInstance Type=date:CommentCollection}" + d:DataContext="{d:DesignInstance Type=data:CommentCollection}" Background="Transparent" RequestedTheme="Dark" mc:Ignorable="d"> - + - + \ No newline at end of file diff --git a/TrueLove.UWP/Views/ExtendedSplash.xaml b/TrueLove.UWP/Views/ExtendedSplash.xaml index 51d8492..487bb62 100644 --- a/TrueLove.UWP/Views/ExtendedSplash.xaml +++ b/TrueLove.UWP/Views/ExtendedSplash.xaml @@ -4,8 +4,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" + Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Loaded="Page_Loaded" + RequestedTheme="Dark" mc:Ignorable="d"> @@ -17,19 +18,57 @@ Height="50" HorizontalAlignment="Center" /> + + + + + + + + + + Double-click the title to return to the top. + + + + + + Slide left or right to switch hamburger menu. + + + + + - Preparing... + Preparing... + Style="{ThemeResource BodyTextBlockStyle}"> No Internet Connection - + \ No newline at end of file diff --git a/TrueLove.UWP/Views/ExtendedSplash.xaml.cs b/TrueLove.UWP/Views/ExtendedSplash.xaml.cs index 506ab22..c8f84a7 100644 --- a/TrueLove.UWP/Views/ExtendedSplash.xaml.cs +++ b/TrueLove.UWP/Views/ExtendedSplash.xaml.cs @@ -133,10 +133,11 @@ async void PreLoading() } } while (!File.Exists(path)); - } - Register.RegisterBackgroundTask("ToastBackgroundTask"); - Register.RegisterBackgroundTask("TileFeedBackgroundTask", "BackgroundTasks.TileFeedBackgroundTask"); + //Assembly.Tile(); + Register.RegisterBackgroundTask("ToastBackgroundTask"); + Register.RegisterBackgroundTask("TileFeedBackgroundTask", "BackgroundTasks.TileFeedBackgroundTask"); + } DismissExtendedSplash(); } diff --git a/TrueLove.UWP/Views/ImagesPage.xaml b/TrueLove.UWP/Views/ImagesPage.xaml index b720444..a383130 100644 --- a/TrueLove.UWP/Views/ImagesPage.xaml +++ b/TrueLove.UWP/Views/ImagesPage.xaml @@ -5,10 +5,11 @@ xmlns:animations="using:Microsoft.Toolkit.Uwp.UI.Animations" xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:date="using:TrueLove.Lib.Models.Code" + xmlns:data="using:TrueLove.Lib.Models.Code" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - d:DataContext="{d:DesignInstance Type=date:ImageCollection}" + d:DataContext="{d:DesignInstance Type=data:ImageCollection}" Background="Transparent" + RequestedTheme="Dark" mc:Ignorable="d">