mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
advancement on onclick install model AND fix circual dependency
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import { timer } from "rxjs";
|
||||
import { MSModel } from "shared/models/model-saber/model-saber.model";
|
||||
import { IpcService } from "./ipc.service";
|
||||
import { ProgressBarService } from "./progress-bar.service";
|
||||
|
||||
export class ModelDownloaderService {
|
||||
|
||||
private static instance: ModelDownloaderService;
|
||||
|
||||
public static getInstance(): ModelDownloaderService{
|
||||
if(!ModelDownloaderService.instance){ ModelDownloaderService.instance = new ModelDownloaderService(); }
|
||||
return ModelDownloaderService.instance;
|
||||
}
|
||||
|
||||
private readonly ipc: IpcService;
|
||||
private readonly progress: ProgressBarService;
|
||||
|
||||
private constructor(){
|
||||
this.ipc = IpcService.getInstance();
|
||||
this.progress = ProgressBarService.getInstance();
|
||||
}
|
||||
|
||||
|
||||
public async oneClickInstallModel(model: MSModel): Promise<boolean>{
|
||||
|
||||
this.progress.showFake(0.07);
|
||||
|
||||
const res = await this.ipc.send("one-click-install-model", {args: model});
|
||||
|
||||
this.progress.complete();
|
||||
await timer(500).toPromise();
|
||||
this.progress.hide(true);
|
||||
|
||||
return res.success;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user