From 52013b277b53a38a71d5de5a2d37829a4d7a6be9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B9=9D=E9=9B=B6?=
<78294929+JiuLing-zhang@users.noreply.github.com>
Date: Fri, 17 Nov 2023 08:38:14 +0800
Subject: [PATCH] =?UTF-8?q?Windows=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE?=
=?UTF-8?q?=E5=85=B3=E9=97=AD=E6=97=B6=E6=9C=80=E5=B0=8F=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/ListenTogether.Model/EnvironmentSetting.cs | 4 ++--
.../Components/DesktopTitleBar.razor | 9 ++++++++-
src/ListenTogether.Pages/Pages/SettingsPage.razor | 9 +++++++++
.../EnvironmentConfigService.cs | 4 ++--
4 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/src/ListenTogether.Model/EnvironmentSetting.cs b/src/ListenTogether.Model/EnvironmentSetting.cs
index a8536e5..dd595ae 100644
--- a/src/ListenTogether.Model/EnvironmentSetting.cs
+++ b/src/ListenTogether.Model/EnvironmentSetting.cs
@@ -53,9 +53,9 @@ public class GeneralSetting
public int AppThemeInt { get; set; }
///
- /// 关闭时最小化到托盘
+ /// 关闭时最小化
///
- public bool IsHideWindowWhenMinimize { get; set; }
+ public bool IsHideWindowWhenClosed { get; set; } = false;
}
public class SearchSetting
diff --git a/src/ListenTogether.Pages/Components/DesktopTitleBar.razor b/src/ListenTogether.Pages/Components/DesktopTitleBar.razor
index 39bac29..27401c4 100644
--- a/src/ListenTogether.Pages/Components/DesktopTitleBar.razor
+++ b/src/ListenTogether.Pages/Components/DesktopTitleBar.razor
@@ -47,7 +47,14 @@
}
private Task CloseAsync()
{
- WindowTitleBar.Close();
+ if (Settings.Environment.General.IsHideWindowWhenClosed)
+ {
+ WindowTitleBar.Minimize();
+ }
+ else
+ {
+ WindowTitleBar.Close();
+ }
return Task.CompletedTask;
}
diff --git a/src/ListenTogether.Pages/Pages/SettingsPage.razor b/src/ListenTogether.Pages/Pages/SettingsPage.razor
index 84b6379..9cb1d79 100644
--- a/src/ListenTogether.Pages/Pages/SettingsPage.razor
+++ b/src/ListenTogether.Pages/Pages/SettingsPage.razor
@@ -41,6 +41,9 @@
+
外观
@@ -141,6 +144,12 @@
Settings.Environment.General.IsAutoCheckUpdate = value;
await WriteGeneralConfigAsync();
}
+ private async Task OnIsHideWindowWhenClosedChange(bool value)
+ {
+ Settings.Environment.General.IsHideWindowWhenClosed = value;
+ await WriteGeneralConfigAsync();
+ }
+
private async Task OnAppThemeIntChange(int value)
{
Settings.Environment.General.AppThemeInt = value;
diff --git a/src/ListenTogether.Service.Maui/EnvironmentConfigService.cs b/src/ListenTogether.Service.Maui/EnvironmentConfigService.cs
index 804dc2f..f82685e 100644
--- a/src/ListenTogether.Service.Maui/EnvironmentConfigService.cs
+++ b/src/ListenTogether.Service.Maui/EnvironmentConfigService.cs
@@ -30,7 +30,7 @@ public async Task ReadAllSettingsAsync()
{
IsAutoCheckUpdate = generalConfig.IsAutoCheckUpdate,
AppThemeInt = generalConfig.AppThemeInt,
- IsHideWindowWhenMinimize = generalConfig.IsHideWindowWhenMinimize,
+ IsHideWindowWhenClosed = generalConfig.IsHideWindowWhenClosed,
};
//播放设置
@@ -74,7 +74,7 @@ private async Task InitializationEnvironmentSettingAsyn
{
AppThemeInt = 0,
IsAutoCheckUpdate = true,
- IsHideWindowWhenMinimize = true
+ IsHideWindowWhenClosed = false
}).ToJson(),
SearchSettingJson = (new SearchSetting()
{