Load Default Test Project at Startup
All checks were successful
E2E Testing / test (push) Successful in 1m29s

This commit is contained in:
Sebastian Böckelmann 2024-03-19 08:27:40 +01:00
parent b68d2a812c
commit 87368f4e65

View File

@ -126,6 +126,11 @@ function createWindow(): BrowserWindow {
] ]
const menu = Menu.buildFromTemplate(menuTemplate); const menu = Menu.buildFromTemplate(menuTemplate);
Menu.setApplicationMenu(menu) Menu.setApplicationMenu(menu)
loadDevProjectAtStart()
win.webContents.on('did-finish-load', () => {
loadDevProjectAtStart()
})
return win; return win;
} }
@ -160,6 +165,10 @@ try {
}) })
}) })
} catch (e) { } catch (e) {
// Catch Error // Catch Error
// throw e; // throw e;
@ -179,13 +188,22 @@ function openProject() {
}) })
if(selectedPaths != undefined) { if(selectedPaths != undefined) {
projectDirectory = selectedPaths[0]; openProjectFromFile(selectedPaths[0])
console.log("Open Project-Directory: ", projectDirectory)
const loadedProject = SaveProject.loadProject(projectDirectory)
win!.webContents.send("open-project", loadedProject)
} }
} }
function loadDevProjectAtStart() {
const projectDir = path.join(process.cwd(), "testModel/")
openProjectFromFile(projectDir)
}
function openProjectFromFile(openProjectDir: string) {
projectDirectory = openProjectDir
console.log("Open Project-Directory: ", openProjectDir)
const loadedProject = SaveProject.loadProject(openProjectDir)
win!.webContents.send("open-project", loadedProject)
}
function saveProject() { function saveProject() {
win!.webContents.send('get-project-data') win!.webContents.send('get-project-data')
} }