From 87fb0a1e70fb57967f19a03c963cfaac639db071 Mon Sep 17 00:00:00 2001 From: chinons098 Date: Fri, 20 Oct 2023 16:25:57 -0400 Subject: [PATCH] some minor changes --- src/app/app.component.html | 2 +- src/app/app.component.ts | 12 ++-- .../system-service/start.process.service.ts | 40 -------------- .../system-service/trigger.process.service.ts | 55 +++++++++++++++++++ .../filemanager/filemanager.component.ts | 10 ++-- .../system-apps/window/window.component.css | 40 +++++++------- .../system-apps/window/window.component.html | 9 ++- .../system-apps/window/window.component.ts | 4 +- src/app/system-files/process.ts | 29 ++++++---- src/app/user-apps/jsdos/jsdos.component.ts | 44 ++++++++++----- 10 files changed, 142 insertions(+), 103 deletions(-) delete mode 100644 src/app/shared/system-service/start.process.service.ts create mode 100644 src/app/shared/system-service/trigger.process.service.ts diff --git a/src/app/app.component.html b/src/app/app.component.html index 40330dce..7b6998f4 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,6 +1,6 @@ - + diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 37f59c42..8b495bc2 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -5,7 +5,7 @@ import { RunningProcessService } from './shared/system-service/running.process.s import { Process } from './system-files/process'; import { ComponentReferenceService } from './shared/system-service/component.reference.service'; import { Subscription } from 'rxjs'; -import { StartProcessService } from './shared/system-service/start.process.service'; +import { TriggerProcessService } from './shared/system-service/trigger.process.service'; import { BaseComponent } from './system-base/base/base.component'; import { TitleComponent } from './user-apps/title/title.component'; import { GreetingComponent } from './user-apps/greeting/greeting.component'; @@ -32,7 +32,7 @@ export class AppComponent implements OnDestroy, AfterViewInit { private _processIdService:ProcessIDService; private _runningProcessService:RunningProcessService; private _componentReferenceService:ComponentReferenceService; - private _startProcessService:StartProcessService; + private _triggerProcessService:TriggerProcessService; private _sessionMangamentServices:SessionManagmentService; private _componentRefView!:ViewRef; private _appDirectory:AppDirectory; @@ -63,18 +63,18 @@ export class AppComponent implements OnDestroy, AfterViewInit { ]; - constructor( processIdService:ProcessIDService, runningProcessService:RunningProcessService,componentReferenceService:ComponentReferenceService, startProcessService:StartProcessService, + constructor( processIdService:ProcessIDService, runningProcessService:RunningProcessService,componentReferenceService:ComponentReferenceService, triggerProcessService:TriggerProcessService, sessionMangamentServices:SessionManagmentService){ this._processIdService = processIdService this.processId = this._processIdService.getNewProcessId() this._componentReferenceService = componentReferenceService; this._runningProcessService = runningProcessService; - this._startProcessService = startProcessService; + this._triggerProcessService = triggerProcessService; this._sessionMangamentServices = sessionMangamentServices; - this._startProcessSub = this._startProcessService.startProcessNotify.subscribe((appName) =>{this.loadApps(appName)}) - this._startProcessSub = this._startProcessService.appNotFoundNotify.subscribe((appName) =>{this.loadApps(appName)}) + this._startProcessSub = this._triggerProcessService.startProcessNotify.subscribe((appName) =>{this.loadApps(appName)}) + this._startProcessSub = this._triggerProcessService.appNotFoundNotify.subscribe((appName) =>{this.loadApps(appName)}) this._runningProcessService.closeProcessNotify.subscribe((p) =>{this.onCloseBtnClicked(p)}) this._runningProcessService.addProcess(this.getComponentDetail()); diff --git a/src/app/shared/system-service/start.process.service.ts b/src/app/shared/system-service/start.process.service.ts deleted file mode 100644 index 8adac929..00000000 --- a/src/app/shared/system-service/start.process.service.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Injectable } from "@angular/core"; -import { Subject } from "rxjs"; -import { RunningProcessService } from "./running.process.service"; -import { AppDirectory } from "src/app/system-files/app.directory"; - -@Injectable({ - providedIn: 'root' -}) - -export class StartProcessService{ - - private _runningProcessService:RunningProcessService; - private _appDirectory:AppDirectory; - - startProcessNotify: Subject = new Subject(); - appNotFoundNotify: Subject = new Subject(); - appIsRunningNotify: Subject = new Subject(); - - constructor(runningProcessService:RunningProcessService){ - this._runningProcessService = runningProcessService; - this._appDirectory = new AppDirectory(); - } - - - startApplication(appName:string):void{ - - if(this._appDirectory.appExist(appName)){ - - if(!this._runningProcessService.isProcessRunning(appName)){ - this.startProcessNotify.next(appName); - return - } - this.appNotFoundNotify.next(appName); - return; - } - this.appNotFoundNotify.next(appName); - return; - } - -} \ No newline at end of file diff --git a/src/app/shared/system-service/trigger.process.service.ts b/src/app/shared/system-service/trigger.process.service.ts new file mode 100644 index 00000000..d78c4419 --- /dev/null +++ b/src/app/shared/system-service/trigger.process.service.ts @@ -0,0 +1,55 @@ +import { Injectable } from "@angular/core"; +import { Subject } from "rxjs"; +import { RunningProcessService } from "./running.process.service"; +import { AppDirectory } from "src/app/system-files/app.directory"; +import { FileInfo } from "src/app/system-files/fileinfo"; + +@Injectable({ + providedIn: 'root' +}) + +export class TriggerProcessService{ + + private _runningProcessService:RunningProcessService; + private _appDirectory:AppDirectory; + private _TriggerList:FileInfo[]; + + startProcessNotify: Subject = new Subject(); + appNotFoundNotify: Subject = new Subject(); + appIsRunningNotify: Subject = new Subject(); + + constructor(runningProcessService:RunningProcessService){ + this._runningProcessService = runningProcessService; + this._appDirectory = new AppDirectory(); + this._TriggerList = []; + } + + startApplication(file:FileInfo):void{ + + if(this._appDirectory.appExist(file.getOpensWith)){ + + if(!this._runningProcessService.isProcessRunning(file.getOpensWith)){ + this.startProcessNotify.next(file.getOpensWith); + this._TriggerList.push(file); + return + } + this.appNotFoundNotify.next(file.getOpensWith); + return; + } + this.appNotFoundNotify.next(file.getOpensWith); + return; + } + + /** + * Getting the last process from the Trigger, will remove it the TriggerList. + */ + getLastProcessTrigger():FileInfo{ + + if(this._TriggerList.length > 0){ + return this._TriggerList.pop() || new FileInfo; + } + + return new FileInfo; + } + +} \ No newline at end of file diff --git a/src/app/system-apps/filemanager/filemanager.component.ts b/src/app/system-apps/filemanager/filemanager.component.ts index e29a4ff9..01a10587 100644 --- a/src/app/system-apps/filemanager/filemanager.component.ts +++ b/src/app/system-apps/filemanager/filemanager.component.ts @@ -7,7 +7,7 @@ import { Process } from 'src/app/system-files/process'; import { FileEntry } from 'src/app/system-files/fileentry'; import { FileInfo } from 'src/app/system-files/fileinfo'; import { Subscription } from 'rxjs'; -import { StartProcessService } from 'src/app/shared/system-service/start.process.service'; +import { TriggerProcessService } from 'src/app/shared/system-service/trigger.process.service'; @Component({ selector: 'cos-filemanager', @@ -24,7 +24,7 @@ export class FilemanagerComponent implements OnInit, AfterViewInit, OnDestroy { private _fileService:FileService private _directoryFilesEntires!:FileEntry[]; private _dirFilesUpdatedSub!: Subscription; - private _startProcessService:StartProcessService; + private _triggerProcessService:TriggerProcessService; hasWindow = false; icon = ''; @@ -36,11 +36,11 @@ export class FilemanagerComponent implements OnInit, AfterViewInit, OnDestroy { files:FileInfo[] = []; - constructor( processIdService:ProcessIDService, runningProcessService:RunningProcessService, fileInfoService:FileService, startProcessService:StartProcessService) { + constructor( processIdService:ProcessIDService, runningProcessService:RunningProcessService, fileInfoService:FileService, triggerProcessService:TriggerProcessService) { this._processIdService = processIdService; this._runningProcessService = runningProcessService; this._fileService = fileInfoService; - this._startProcessService = startProcessService; + this._triggerProcessService = triggerProcessService; this.processId = this._processIdService.getNewProcessId(); this._runningProcessService.addProcess(this.getComponentDetail()); @@ -115,7 +115,7 @@ export class FilemanagerComponent implements OnInit, AfterViewInit, OnDestroy { await this.loadFilesInfoAsync(); }else{ - this._startProcessService.startApplication(file.getOpensWith); + this._triggerProcessService.startApplication(file); } } diff --git a/src/app/system-apps/window/window.component.css b/src/app/system-apps/window/window.component.css index 50cfc261..fee136a0 100644 --- a/src/app/system-apps/window/window.component.css +++ b/src/app/system-apps/window/window.component.css @@ -1,5 +1,5 @@ -.section{ + .section{ font-size: 100px; text-align: center; background-color: #808080; @@ -13,9 +13,9 @@ margin-left: -100px; outline: 1px hsl(0deg 0% 20%/70%); overflow:hidden -} + } -.window-dd-box { + .window-dd-box { cursor:none; justify-content: center; align-items: center; @@ -87,23 +87,23 @@ /* width: 10px; */ } -nav{ - display: flex; - position: absolute; - right: 0; - height: 30px; -} + nav{ + display: flex; + position: absolute; + right: 0; + height: 30px; + } -/* change cursor style to normal*/ -.ng-draggable { - cursor: auto; -} + /* change cursor style to normal*/ + .ng-draggable { + cursor: auto; + } -.ng-dragging { - cursor: auto; -} + .ng-dragging { + cursor: auto; + } -/* Hide draggable corner*/ -.ng-resizable-diagonal{ - border-bottom: 12px solid transparent; -} \ No newline at end of file + /* Hide draggable corner*/ + .ng-resizable-diagonal{ + border-bottom: 12px solid transparent; + } \ No newline at end of file diff --git a/src/app/system-apps/window/window.component.html b/src/app/system-apps/window/window.component.html index 4d461688..2cf7cfea 100644 --- a/src/app/system-apps/window/window.component.html +++ b/src/app/system-apps/window/window.component.html @@ -14,26 +14,25 @@