新增询问窗口

This commit is contained in:
xuncha committed 2026-03-16 17:21:59 +08:00
1 parent 999ddaeb9a
commit f2b1b07f58
7 files changed
+206 -17

No files matched your search

+13 -3
View File
@@ -327,8 +327,19 @@ function App() {
setUpdateInfo(null)
}
const handleWindowCloseAction = async (action: 'tray' | 'quit' | 'cancel') => {
const handleWindowCloseAction = async (
action: 'tray' | 'quit' | 'cancel',
rememberChoice = false
) => {
setShowCloseDialog(false)
if (rememberChoice && action !== 'cancel') {
try {
await configService.setWindowCloseBehavior(action)
} catch (error) {
console.error('保存关闭偏好失败:', error)
}
}
try {
await window.electronAPI.window.respondCloseConfirm(action)
} catch (error) {
@@ -617,8 +628,7 @@ function App() {
<WindowCloseDialog
open={showCloseDialog}
canMinimizeToTray={canMinimizeToTray}
onTray={() => handleWindowCloseAction('tray')}
onQuit={() => handleWindowCloseAction('quit')}
onSelect={(action, rememberChoice) => handleWindowCloseAction(action, rememberChoice)}
onCancel={() => handleWindowCloseAction('cancel')}
/>