From efbcfb7a1512fd0eb788f6eb0977757b7f0502b6 Mon Sep 17 00:00:00 2001 From: Stefanos Doumpoulakis <dubulak@gmail.com> Date: Fri, 20 Oct 2023 15:09:31 +0300 Subject: [PATCH] bugfix: issue 185: cannot open new job editor --- VECTO/GUI/MainForm.vb | 15 ++++++++------- VECTO/GUI/VectoJobForm.vb | 4 +++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/VECTO/GUI/MainForm.vb b/VECTO/GUI/MainForm.vb index c59534e406..2f2e1d80e3 100644 --- a/VECTO/GUI/MainForm.vb +++ b/VECTO/GUI/MainForm.vb @@ -1411,13 +1411,6 @@ lbFound: 'Open Job Editor and open file (or new file) Friend Sub OpenVECTOeditor(filePathOrType As String, Optional jobType As VectoSimulationJobType = Nothing) - Dim jobDataProvider As IInputDataProvider = JSONInputDataFactory.ReadComponentData(filePathOrType) - Dim vtpEngineeringJob As IVTPEngineeringInputDataProvider = TryCast(jobDataProvider, IVTPEngineeringInputDataProvider) - Dim vtpDeclarationJob As IVTPDeclarationInputDataProvider = TryCast(jobDataProvider, IVTPDeclarationInputDataProvider) - - 'Declaration is the base class for EngineeringJobInputData, hence is valid for both Eng. and Decl. - If jobType = Nothing Then jobType = TryCast(jobDataProvider, IDeclarationJobInputData).JobType - If filePathOrType = "<New>" Then ShowVectoJobForm(jobType) VectoJobForm.VectoNew() @@ -1426,6 +1419,14 @@ lbFound: VectoVTPJobForm.VectoNew() Else Try + Dim jobDataProvider As IInputDataProvider = JSONInputDataFactory.ReadComponentData(filePathOrType) + + 'Declaration is the base class for EngineeringJobInputData, hence is valid for both Eng. and Decl. + If jobType = Nothing Then jobType = TryCast(jobDataProvider, IDeclarationJobInputData).JobType + + Dim vtpEngineeringJob As IVTPEngineeringInputDataProvider = TryCast(jobDataProvider, IVTPEngineeringInputDataProvider) + Dim vtpDeclarationJob As IVTPDeclarationInputDataProvider = TryCast(jobDataProvider, IVTPDeclarationInputDataProvider) + If vtpEngineeringJob Is Nothing AndAlso vtpDeclarationJob Is Nothing Then ShowVectoJobForm(jobType) VectoJobForm.VECTOload2Form(filePathOrType) diff --git a/VECTO/GUI/VectoJobForm.vb b/VECTO/GUI/VectoJobForm.vb index 3b6938683f..a271cb1e0e 100644 --- a/VECTO/GUI/VectoJobForm.vb +++ b/VECTO/GUI/VectoJobForm.vb @@ -165,7 +165,9 @@ Public Class VectoJobForm Case VectoSimulationJobType.ConventionalVehicle, VectoSimulationJobType.ParallelHybridVehicle, VectoSimulationJobType.IHPC, VectoSimulationJobType.SerialHybridVehicle, VectoSimulationJobType.IEPC_S auxList = New HeavyLorryAuxiliaryDataAdapter().AuxiliaryTypes.OrderBy(Function(x) x).ToList() Case VectoSimulationJobType.BatteryElectricVehicle, VectoSimulationJobType.IEPC_E - auxList = new HeavyLorryPEVAuxiliaryDataAdapter().AuxiliaryTypes.OrderBy(Function(x) x).ToList() + auxList = New HeavyLorryPEVAuxiliaryDataAdapter().AuxiliaryTypes.OrderBy(Function(x) x).ToList() + Case Else + auxList = New List(Of AuxiliaryType) End Select Dim auxTechs = New Dictionary(Of AuxiliaryType, IDeclarationAuxiliaryTable) from { -- GitLab