初始化
This commit is contained in:
42
src/core/process/AppProcess.ts
Normal file
42
src/core/process/AppProcess.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { v4 as uuidV4 } from 'uuid';
|
||||
import XSystem from '../XSystem.ts'
|
||||
import type { AppProcessInfo } from '../process/AppProcessInfo.ts'
|
||||
import WindowForm from '../window/WindowForm.ts'
|
||||
|
||||
/**
|
||||
* 进程
|
||||
*/
|
||||
export default class AppProcess {
|
||||
private readonly _id: string = uuidV4();
|
||||
private readonly _processInfo: AppProcessInfo;
|
||||
// 当前进程的窗体集合
|
||||
private _windowForms: Map<string, WindowForm> = new Map();
|
||||
|
||||
public get id() {
|
||||
return this._id;
|
||||
}
|
||||
public get processInfo() {
|
||||
return this._processInfo;
|
||||
}
|
||||
public get windowForms() {
|
||||
return this._windowForms;
|
||||
}
|
||||
|
||||
constructor(info: AppProcessInfo) {
|
||||
console.log(`AppProcess: ${info.name}`)
|
||||
this._processInfo = info;
|
||||
|
||||
const startName = info.startName;
|
||||
|
||||
XSystem.instance.processManages.addProcess(this);
|
||||
// 通过设置 isJustProcess 为 true,则不会创建窗体
|
||||
if (!info.isJustProcess) {
|
||||
this.openWindowForm(startName)
|
||||
}
|
||||
}
|
||||
|
||||
public openWindowForm(startName: string) {
|
||||
const window = new WindowForm(this, startName);
|
||||
this._windowForms.set(window.id, window);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user