diff --git a/VECTO/GUI/MainForm.vb b/VECTO/GUI/MainForm.vb index c5bfc0239d1d84f1bd73e8a8c1fdd245c77189e2..c01aca312aeeb46e00e4a2dbd5c8e293b6766044 100644 --- a/VECTO/GUI/MainForm.vb +++ b/VECTO/GUI/MainForm.vb @@ -451,7 +451,7 @@ Public Class MainForm MsgBox(ex.Message, MsgBoxStyle.OkOnly, "Error loading Engine File") End Try Case ".VECTO" - OpenVECTOeditor(file, VectoSimulationJobType.ConventionalVehicle) + OpenVECTOeditor(file) Case Else MsgBox("Type '" & GetExtension(file) & "' unknown!", MsgBoxStyle.Critical) End Select @@ -632,7 +632,7 @@ Public Class MainForm If Not File.Exists(f) Then MsgBox(f & " not found!") Else - OpenVECTOeditor(f, VectoSimulationJobType.ConventionalVehicle) + OpenVECTOeditor(f) End If End Sub @@ -1451,28 +1451,29 @@ lbFound: End Sub End Class - 'Open Job Editor and open file (or new file) - Friend Sub OpenVECTOeditor(x As String, jobType As VectoSimulationJobType) + 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 x = "<New>" Then + If filePathOrType = "<New>" Then ShowVectoJobForm(jobType) VectoJobForm.VectoNew() - ElseIf x = "<VTP>" Then + ElseIf filePathOrType = "<VTP>" Then ShowVectoEPTPJobForm() VectoVTPJobForm.VectoNew() Else Try - Dim engJob As IVTPEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadComponentData(x), - IVTPEngineeringInputDataProvider) - Dim declJob As IVTPDeclarationInputDataProvider = TryCast(JSONInputDataFactory.ReadComponentData(x), - IVTPDeclarationInputDataProvider) - If engJob Is Nothing AndAlso declJob Is Nothing Then + If vtpEngineeringJob Is Nothing AndAlso vtpDeclarationJob Is Nothing Then ShowVectoJobForm(jobType) - VectoJobForm.VECTOload2Form(x) + VectoJobForm.VECTOload2Form(filePathOrType) Else ShowVectoEPTPJobForm() - VectoVTPJobForm.VECTOload2Form(x) + VectoVTPJobForm.VECTOload2Form(filePathOrType) End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.OkOnly, "Error loading Vecto Job File") diff --git a/VECTO/GUI/VectoJobForm.Designer.vb b/VECTO/GUI/VectoJobForm.Designer.vb index c57d2620a36a7a39ba41f3dcf4998831cf37b2a1..452a8d2d5947a80eb9827fadd19d2961aced36d6 100644 --- a/VECTO/GUI/VectoJobForm.Designer.vb +++ b/VECTO/GUI/VectoJobForm.Designer.vb @@ -920,7 +920,7 @@ Partial Class VectoJobForm Me.gbElectricAux.TabIndex = 2 Me.gbElectricAux.TabStop = false Me.gbElectricAux.Text = "Electric Auxiliaries" - Me.gbElectricAux.Visible = false + Me.gbElectricAux.Visible = True ' 'Label46 '