保存一下

This commit is contained in:
2025-08-29 14:22:20 +08:00
parent edb725354e
commit 17024fbf89
15 changed files with 74 additions and 205 deletions

View File

@@ -1,12 +1,7 @@
import ProcessManageImpl from './process/impl/ProcessManageImpl.ts'
import ProcessImpl from './process/impl/ProcessImpl.ts'
import { isUndefined } from 'lodash'
import { BasicSystemProcess } from '@/core/system/BasicSystemProcess.ts'
import { DesktopProcess } from '@/core/desktop/DesktopProcess.ts'
import type { IAllEvent } from '@/core/events/EventTypes.ts'
import type { IEventBuilder } from '@/core/events/IEventBuilder.ts'
import { EventBuilderImpl } from '@/core/events/impl/EventBuilderImpl.ts'
import type { IProcessManage } from '@/core/process/IProcessManage.ts'
import type { IProcess } from '@/core/process/IProcess.ts'
import type { IProcessInfo } from '@/core/process/IProcessInfo.ts'
import { ObservableWeakRefImpl } from '@/core/state/impl/ObservableWeakRefImpl.ts'
@@ -15,6 +10,7 @@ import { NotificationService } from '@/core/service/services/NotificationService
import { SettingsService } from '@/core/service/services/SettingsService.ts'
import { WindowFormService } from '@/core/service/services/WindowFormService.ts'
import { UserService } from '@/core/service/services/UserService.ts'
import { processManager } from '@/core/process/ProcessManager.ts'
interface IGlobalState {
isLogin: boolean
@@ -23,8 +19,6 @@ interface IGlobalState {
export default class XSystem {
private static _instance: XSystem = new XSystem()
private _processManage: IProcessManage = new ProcessManageImpl()
private _eventManage: IEventBuilder<IAllEvent> = new EventBuilderImpl()
private _globalState: IObservable<IGlobalState> = new ObservableWeakRefImpl<IGlobalState>({
isLogin: false
})
@@ -41,12 +35,6 @@ export default class XSystem {
public static get instance() {
return this._instance
}
public get processManage() {
return this._processManage
}
public get eventManage() {
return this._eventManage
}
public get globalState() {
return this._globalState
}
@@ -69,14 +57,14 @@ export default class XSystem {
proc: string | IProcessInfo,
constructor?: new (info: IProcessInfo) => T,
): Promise<T> {
let info = typeof proc === 'string' ? this._processManage.findProcessInfoByName(proc)! : proc
let info = typeof proc === 'string' ? processManager.findProcessInfoByName(proc)! : proc
if (isUndefined(info)) {
throw new Error(`未找到进程信息:${proc}`)
}
// 是单例应用
if (info.singleton) {
let process = this._processManage.findProcessByName(info.name)
let process = processManager.findProcessByName(info.name)
if (process) {
return process as T
}