From b77a20f9b0c615027c407e3f96de38c8ef5770f6 Mon Sep 17 00:00:00 2001 From: Azure <983547216@qq.com> Date: Sun, 28 Sep 2025 12:05:59 +0800 Subject: [PATCH] 1 --- src/events/DesktopEventManager.ts | 16 ----- src/events/EventManager.ts | 35 ----------- src/events/WindowFormEventManager.ts | 76 ------------------------ src/events/impl/EventBuilderImpl.ts | 2 +- src/services/SystemServiceIntegration.ts | 37 ++++++++---- 5 files changed, 27 insertions(+), 139 deletions(-) delete mode 100644 src/events/DesktopEventManager.ts delete mode 100644 src/events/EventManager.ts delete mode 100644 src/events/WindowFormEventManager.ts diff --git a/src/events/DesktopEventManager.ts b/src/events/DesktopEventManager.ts deleted file mode 100644 index 0153e7f..0000000 --- a/src/events/DesktopEventManager.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { EventBuilderImpl } from '@/events/impl/EventBuilderImpl.ts' -import type { IEventMap } from '@/events/IEventBuilder.ts' -import type { IDesktopAppIcon } from '@/ui/types/IDesktopAppIcon.ts' - -/** - * 桌面相关的事件 - */ -export interface IDesktopEvent extends IEventMap { - /** - * 桌面应用位置改变 - */ - desktopAppPosChange: (info: IDesktopAppIcon) => void; -} - -/** 窗口事件管理器 */ -export const desktopEM = new EventBuilderImpl() diff --git a/src/events/EventManager.ts b/src/events/EventManager.ts deleted file mode 100644 index 6b63a22..0000000 --- a/src/events/EventManager.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { EventBuilderImpl } from '@/core/events/impl/EventBuilderImpl.ts' -import type { IEventMap } from '@/core/events/IEventBuilder.ts' -import type { IDesktopAppIcon } from '@/core/desktop/types/IDesktopAppIcon.ts' - -export const eventManager = new EventBuilderImpl() - -/** - * 系统进程的事件 - * @description - *

onAuthChange - 认证状态改变

- *

onThemeChange - 主题改变

- */ -export interface IBasicSystemEvent extends IEventMap { - /** 认证状态改变 */ - onAuthChange: () => {}, - /** 主题改变 */ - onThemeChange: (theme: string) => void -} - -/** - * 桌面进程的事件 - * @description - *

onDesktopRootDomResize - 桌面根dom尺寸改变

- *

onDesktopProcessInitialize - 桌面进程初始化完成

- */ -export interface IDesktopEvent extends IEventMap { - /** 桌面根dom尺寸改变 */ - onDesktopRootDomResize: (width: number, height: number) => void - /** 桌面进程初始化完成 */ - onDesktopProcessInitialize: () => void - /** 桌面应用图标位置改变 */ - onDesktopAppIconPos: (iconInfo: IDesktopAppIcon) => void -} - -export interface IAllEvent extends IDesktopEvent, IBasicSystemEvent {} diff --git a/src/events/WindowFormEventManager.ts b/src/events/WindowFormEventManager.ts deleted file mode 100644 index 06a41eb..0000000 --- a/src/events/WindowFormEventManager.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { EventBuilderImpl } from '@/events/impl/EventBuilderImpl.ts' -import type { IEventMap } from '@/events/IEventBuilder.ts' -import type { TWindowFormState } from '@/ui/types/WindowFormTypes.ts' - -/** - * 窗口的事件 - */ -export interface IWindowFormEvent extends IEventMap { - /** - * 窗口最小化 - * @param id 窗口id - */ - windowFormMinimize: (id: string) => void - /** - * 窗口最大化 - * @param id 窗口id - */ - windowFormMaximize: (id: string) => void - /** - * 窗口还原 - * @param id 窗口id - */ - windowFormRestore: (id: string) => void - /** - * 窗口关闭 - * @param id 窗口id - */ - windowFormClose: (id: string) => void - /** - * 窗口聚焦 - * @param id 窗口id - */ - windowFormFocus: (id: string) => void - /** - * 窗口数据更新 - * @param data 窗口数据 - */ - windowFormDataUpdate: (data: IWindowFormDataUpdateParams) => void - /** - * 窗口创建完成 - */ - windowFormCreated: () => void - /** - * 开始调整窗体尺寸 - * @param id 窗口id - */ - windowFormResizeStart: (id: string) => void - /** - * 调整尺寸过程中 - * @param data 窗口数据 - */ - windowFormResizing: (data: IWindowFormDataUpdateParams) => void - /** - * 完成窗体尺寸调整 - * @param id 窗口id - */ - windowFormResizeEnd: (id: string) => void -} - -export interface IWindowFormDataUpdateParams { - /** 窗口id */ - id: string - /** 窗口状态 */ - state: TWindowFormState - /** 窗口宽度 */ - width: number - /** 窗口高度 */ - height: number - /** 窗口x坐标(左上角) */ - x: number - /** 窗口y坐标(左上角) */ - y: number -} - -/** 窗口事件管理器 */ -export const wfem = new EventBuilderImpl() diff --git a/src/events/impl/EventBuilderImpl.ts b/src/events/impl/EventBuilderImpl.ts index 2c29425..aaa52d6 100644 --- a/src/events/impl/EventBuilderImpl.ts +++ b/src/events/impl/EventBuilderImpl.ts @@ -1,4 +1,4 @@ -import type { IEventBuilder, IEventMap } from '@/core/events/IEventBuilder.ts' +import type { IEventBuilder, IEventMap } from '../IEventBuilder.ts' interface HandlerWrapper any> { fn: T diff --git a/src/services/SystemServiceIntegration.ts b/src/services/SystemServiceIntegration.ts index f41a8ff..2690fcc 100644 --- a/src/services/SystemServiceIntegration.ts +++ b/src/services/SystemServiceIntegration.ts @@ -9,7 +9,22 @@ import { EventCommunicationService } from './EventCommunicationService' import { ApplicationSandboxEngine } from './ApplicationSandboxEngine' import { ApplicationLifecycleManager } from './ApplicationLifecycleManager' import { externalAppDiscovery } from './ExternalAppDiscovery' -import type { IWindowFormDataUpdateParams } from '@/events/WindowFormEventManager' +import type { TWindowFormState } from '@/ui/types/WindowFormTypes' + +export interface IWindowFormDataUpdateParams { + /** 窗口id */ + id: string + /** 窗口状态 */ + state: TWindowFormState + /** 窗口宽度 */ + width: number + /** 窗口高度 */ + height: number + /** 窗口x坐标(左上角) */ + x: number + /** 窗口y坐标(左上角) */ + y: number +} /** * 系统服务配置接口 @@ -112,7 +127,7 @@ export class SystemServiceIntegration { } this.startTime = new Date() - this.eventBus = new EventBuilderImpl() + this.eventBus = new EventBuilderImpl() this.setupGlobalErrorHandling() } @@ -627,17 +642,17 @@ export class SystemServiceIntegration { case 'move': // 实现窗体移动功能 - const window = this.windowService.getWindow(windowId); + const window = this.windowService.getWindow(windowId) if (window && window.element) { // 更新窗体位置 - window.config.x = data.x; - window.config.y = data.y; - window.element.style.left = `${data.x}px`; - window.element.style.top = `${data.y}px`; - window.element.style.transform = 'none'; // 确保移除transform - return true; + window.config.x = data.x + window.config.y = data.y + window.element.style.left = `${data.x}px` + window.element.style.top = `${data.y}px` + window.element.style.transform = 'none' // 确保移除transform + return true } - return false; + return false case 'minimize': return this.windowService.minimizeWindow(windowId) @@ -939,4 +954,4 @@ export class SystemServiceIntegration { console.log(`[SystemService] ${message}`, data) } } -} \ No newline at end of file +}