11
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { reactive, ref } from 'vue'
|
||||
import { EventBuilderImpl } from '@/events/impl/EventBuilderImpl'
|
||||
import type { IEventBuilder } from '@/events/IEventBuilder'
|
||||
import type { EventCommunicationEvents, WindowFormDataUpdateParams } from './EventCommunicationService'
|
||||
import type { ResourceType } from './ResourceService'
|
||||
|
||||
// 导入所有服务
|
||||
import { WindowService } from './WindowService'
|
||||
@@ -11,21 +13,6 @@ import { ApplicationLifecycleManager } from './ApplicationLifecycleManager'
|
||||
import { externalAppDiscovery } from './ExternalAppDiscovery'
|
||||
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
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统服务配置接口
|
||||
*/
|
||||
@@ -83,7 +70,7 @@ export class SystemServiceIntegration {
|
||||
private startTime: Date
|
||||
|
||||
// 核心服务实例
|
||||
private eventBus: IEventBuilder<any>
|
||||
private eventBus: IEventBuilder<EventCommunicationEvents>
|
||||
private windowService!: WindowService
|
||||
private resourceService!: ResourceService
|
||||
private eventService!: EventCommunicationService
|
||||
@@ -127,7 +114,7 @@ export class SystemServiceIntegration {
|
||||
}
|
||||
|
||||
this.startTime = new Date()
|
||||
this.eventBus = new EventBuilderImpl<any>()
|
||||
this.eventBus = new EventBuilderImpl<EventCommunicationEvents>()
|
||||
|
||||
this.setupGlobalErrorHandling()
|
||||
}
|
||||
@@ -388,7 +375,7 @@ export class SystemServiceIntegration {
|
||||
|
||||
// 监听窗体状态变化(来自 WindowService 的 onStateChange 事件)
|
||||
this.eventBus.addEventListener(
|
||||
'onStateChange',
|
||||
'onWindowStateChanged',
|
||||
(windowId: string, newState: string, oldState: string) => {
|
||||
console.log(
|
||||
`[SystemIntegration] 接收到窗体状态变化事件: ${windowId} ${oldState} -> ${newState}`,
|
||||
@@ -403,7 +390,7 @@ export class SystemServiceIntegration {
|
||||
)
|
||||
|
||||
// 监听窗体关闭事件,自动停止对应的应用
|
||||
this.eventBus.addEventListener('onClose', async (windowId: string) => {
|
||||
this.eventBus.addEventListener('onWindowClose', async (windowId: string) => {
|
||||
console.log(`[SystemIntegration] 接收到窗体关闭事件: ${windowId}`)
|
||||
// 查找对应的应用
|
||||
const runningApps = this.lifecycleManager.getRunningApps()
|
||||
@@ -423,7 +410,7 @@ export class SystemServiceIntegration {
|
||||
// 监听窗体数据更新事件
|
||||
this.eventBus.addEventListener(
|
||||
'onWindowFormDataUpdate',
|
||||
(data: IWindowFormDataUpdateParams) => {
|
||||
(data: WindowFormDataUpdateParams) => {
|
||||
console.log(`[SystemIntegration] 接收到窗体数据更新事件:`, data)
|
||||
// 只有在有订阅者时才发送消息
|
||||
if (this.eventService.getChannelSubscriberCount('window-form-data-update') > 0) {
|
||||
@@ -436,7 +423,7 @@ export class SystemServiceIntegration {
|
||||
)
|
||||
|
||||
// 监听窗体调整尺寸开始事件
|
||||
this.eventBus.addEventListener('onResizeStart', (windowId: string) => {
|
||||
this.eventBus.addEventListener('onWindowFormResizeStart', (windowId: string) => {
|
||||
console.log(`[SystemIntegration] 接收到窗体调整尺寸开始事件: ${windowId}`)
|
||||
// 只有在有订阅者时才发送消息
|
||||
if (this.eventService.getChannelSubscriberCount('window-form-resize-start') > 0) {
|
||||
@@ -448,7 +435,7 @@ export class SystemServiceIntegration {
|
||||
|
||||
// 监听窗体调整尺寸过程中事件
|
||||
this.eventBus.addEventListener(
|
||||
'onResizing',
|
||||
'onWindowFormResizing',
|
||||
(windowId: string, width: number, height: number) => {
|
||||
console.log(`[SystemIntegration] 接收到窗体调整尺寸过程中事件: ${windowId}`, {
|
||||
width,
|
||||
@@ -468,7 +455,7 @@ export class SystemServiceIntegration {
|
||||
)
|
||||
|
||||
// 监听窗体调整尺寸结束事件
|
||||
this.eventBus.addEventListener('onResizeEnd', (windowId: string) => {
|
||||
this.eventBus.addEventListener('onWindowFormResizeEnd', (windowId: string) => {
|
||||
console.log(`[SystemIntegration] 接收到窗体调整尺寸结束事件: ${windowId}`)
|
||||
// 只有在有订阅者时才发送消息
|
||||
if (this.eventService.getChannelSubscriberCount('window-form-resize-end') > 0) {
|
||||
@@ -481,7 +468,7 @@ export class SystemServiceIntegration {
|
||||
// 监听资源配额超出
|
||||
this.eventBus.addEventListener(
|
||||
'onResourceQuotaExceeded',
|
||||
(appId: string, resourceType: string) => {
|
||||
(appId: string, resourceType: ResourceType) => {
|
||||
console.log(`[SystemIntegration] 接收到资源配额超出事件: ${appId} - ${resourceType}`)
|
||||
this.eventService.sendMessage('system', 'resource-quota-exceeded', {
|
||||
appId,
|
||||
|
||||
Reference in New Issue
Block a user