From dd8866ac9a649fae4868139ee64ce8c4f718e7b2 Mon Sep 17 00:00:00 2001 From: lixinyang123 Date: Tue, 6 Feb 2024 13:47:04 +0800 Subject: [PATCH 1/3] update dependences --- MixApp.Web/MixApp.Web.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MixApp.Web/MixApp.Web.csproj b/MixApp.Web/MixApp.Web.csproj index 48ad197..4aa0b42 100644 --- a/MixApp.Web/MixApp.Web.csproj +++ b/MixApp.Web/MixApp.Web.csproj @@ -15,8 +15,8 @@ - - + + From 1b5017283498380601c074171c888aa6e16a385a Mon Sep 17 00:00:00 2001 From: lixinyang123 Date: Fri, 9 Feb 2024 23:04:56 +0800 Subject: [PATCH 2/3] update dependences --- MixApp.Web/MixApp.Web.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MixApp.Web/MixApp.Web.csproj b/MixApp.Web/MixApp.Web.csproj index 4aa0b42..a2bd5ce 100644 --- a/MixApp.Web/MixApp.Web.csproj +++ b/MixApp.Web/MixApp.Web.csproj @@ -11,11 +11,11 @@ - + - + From 635c8bd80e3d3bae617dd8267889c22e7af4a262 Mon Sep 17 00:00:00 2001 From: lixinyang123 Date: Fri, 16 Feb 2024 13:41:49 +0800 Subject: [PATCH 3/3] fixed some warning --- MixApp.Web/Pages/Setting.razor.cs | 19 +++++++++++-------- MixApp.Web/Services/GlobalEvent.cs | 2 +- MixApp.Web/Shared/MainLayout.razor.cs | 4 ++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/MixApp.Web/Pages/Setting.razor.cs b/MixApp.Web/Pages/Setting.razor.cs index 0b34de3..74d977b 100644 --- a/MixApp.Web/Pages/Setting.razor.cs +++ b/MixApp.Web/Pages/Setting.razor.cs @@ -27,8 +27,11 @@ public Option? SelectedLocale set { selectedLocale = value; - LocalStorage.SetItemAsStringAsync("locale", value?.Value).AsTask(); - JSRunTime!.InvokeVoidAsync("reload").AsTask(); + Task.Run(async () => + { + await LocalStorage.SetItemAsStringAsync("locale", value?.Value ?? string.Empty); + _ = JSRunTime!.InvokeVoidAsync("reload").AsTask(); + }); } } @@ -46,7 +49,7 @@ public Option? SelectedTheme selectedTheme = value; Task.Run(async () => { - await LocalStorage.SetItemAsStringAsync("theme", value?.Value); + await LocalStorage.SetItemAsStringAsync("theme", value?.Value ?? string.Empty); GlobalEvent.ChangeTheme(); }); } @@ -66,7 +69,7 @@ public string? SelectedColor selectedColor = value; Task.Run(async () => { - await LocalStorage.SetItemAsStringAsync("color", value); + await LocalStorage.SetItemAsStringAsync("color", value ?? string.Empty); GlobalEvent.ChangeTheme(); }); } @@ -101,7 +104,7 @@ public string? DownloadProxy // ============================================= // Check Download proxy is correct - LocalStorage.SetItemAsStringAsync("download_proxy", value).AsTask(); + LocalStorage.SetItemAsStringAsync("download_proxy", value ?? string.Empty).AsTask(); downloadProxy = value; } } @@ -117,7 +120,7 @@ protected override async Task OnInitializedAsync() new Option { Text = "p.setting.en_us", Value = "en-US" } ]; - string locale = await LocalStorage.GetItemAsStringAsync("locale").AsTask(); + string? locale = await LocalStorage.GetItemAsStringAsync("locale").AsTask(); selectedLocale = LocaleOptions.SingleOrDefault(i => i.Value == locale); // Init theme options @@ -129,14 +132,14 @@ protected override async Task OnInitializedAsync() new Option { Text = "p.setting.light", Value = "#f5f5f5" } ]; - string theme = await LocalStorage.GetItemAsStringAsync("theme").AsTask(); + string? theme = await LocalStorage.GetItemAsStringAsync("theme").AsTask(); selectedTheme = ThemeOptions.SingleOrDefault(i => i.Value == theme) ?? ThemeOptions.Single(i => i.Text == "p.setting.theme_auto"); // Init base color - string color = await LocalStorage.GetItemAsStringAsync("color").AsTask(); + string? color = await LocalStorage.GetItemAsStringAsync("color").AsTask(); if (string.IsNullOrEmpty(color)) { diff --git a/MixApp.Web/Services/GlobalEvent.cs b/MixApp.Web/Services/GlobalEvent.cs index 6e899e5..adceffa 100644 --- a/MixApp.Web/Services/GlobalEvent.cs +++ b/MixApp.Web/Services/GlobalEvent.cs @@ -228,7 +228,7 @@ public async void DownloadInstaller(Manifest manifest, Installer? installer = nu string url = DownloadProxy + installer?.InstallerUrl; // Check if user set the custome download proxy - string customeProxy = await LocalStorage.GetItemAsStringAsync("download_proxy").AsTask(); + string? customeProxy = await LocalStorage.GetItemAsStringAsync("download_proxy").AsTask(); if (!string.IsNullOrEmpty(customeProxy)) { url = customeProxy + installer?.InstallerUrl; diff --git a/MixApp.Web/Shared/MainLayout.razor.cs b/MixApp.Web/Shared/MainLayout.razor.cs index 8c03ae6..7420c83 100644 --- a/MixApp.Web/Shared/MainLayout.razor.cs +++ b/MixApp.Web/Shared/MainLayout.razor.cs @@ -45,7 +45,7 @@ protected override async Task OnInitializedAsync() private async Task InitTheme() { - string theme = await LocalStorage.GetItemAsStringAsync("theme"); + string? theme = await LocalStorage.GetItemAsStringAsync("theme"); if (string.IsNullOrEmpty(theme)) { @@ -57,7 +57,7 @@ private async Task InitTheme() Theme = theme; } - string color = await LocalStorage.GetItemAsStringAsync("color"); + string? color = await LocalStorage.GetItemAsStringAsync("color"); if (!string.IsNullOrEmpty(color)) {