Newer
Older
' Copyright 2014 European Union.
' Licensed under the EUPL (the 'Licence');
'
' * You may not use this work except in compliance with the Licence.
' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
' * Unless required by applicable law or agreed to in writing,
' software distributed under the Licence is distributed on an "AS IS" basis,
' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
'
' See the LICENSE.txt for the specific language governing permissions and limitations.
Option Infer On
Imports System.Collections.Generic
Imports System.Drawing.Imaging
Imports System.IO
Imports System.Linq
Imports System.Text.RegularExpressions
Imports System.Windows.Forms.DataVisualization.Charting
Imports TUGraz.VECTO.Input_Files
Imports TUGraz.VectoCommon.InputData
Imports TUGraz.VectoCommon.Models
Imports TUGraz.VectoCommon.Utils
Imports TUGraz.VectoCore.InputData.FileIO.JSON
Imports TUGraz.VectoCore.Models.Declaration
''' <summary>
''' Job Editor. Create/Edit VECTO job files (.vecto)
''' </summary>
''' <remarks></remarks>
Public Class VectoJobForm
Public VECTOfile As String
Private _changed As Boolean = False
Private _pgDriver As TabPage
Private _pgDriverOn As Boolean = True
Private _auxDialog As VehicleAuxiliariesDialog
Public EngineIdleSpeed As Double
Public EngineFullLoadFile As String
'AA-TB
'Populate Advanced Auxiliaries
Private Sub PopulateAdvancedAuxiliaries()
'Scan the program directory for DLL's which are AdvancedAuxiliaries and display

Markus QUARITSCH
committed
Dim aList As List(Of AdvancedAuxiliary) = DiscoverAdvancedAuxiliaries()
cboAdvancedAuxiliaries.DataSource = aList
cboAdvancedAuxiliaries.DisplayMember = "AuxiliaryName"
End Sub
'Initialise form
Private Sub F02_GEN_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim x As Integer
EngineIdleSpeed = -1
EngineFullLoadFile = ""
_auxDialog = New VehicleAuxiliariesDialog
_pgDriver = TabPgDriver
For x = 0 To TabControl1.TabCount - 1
TabControl1.TabPages(x).Show()
Next
LvAux.Columns(2).Width = -2
'Declaration Mode
If Cfg.DeclMode Then
LvAux.Columns(2).Text = "Technology"
Else
LvAux.Columns(2).Text = "Input File"
End If
CbEngOnly.Enabled = Not Cfg.DeclMode
GrCycles.Enabled = Not Cfg.DeclMode
GrVACC.Enabled = Not Cfg.DeclMode
PnStartStop.Enabled = Not Cfg.DeclMode
RdOff.Enabled = Not Cfg.DeclMode
GrLAC.Enabled = Not Cfg.DeclMode
ButAuxAdd.Enabled = Not Cfg.DeclMode
ButAuxRem.Enabled = Not Cfg.DeclMode
PnEcoRoll.Enabled = Not Cfg.DeclMode
_changed = False
'AA-TB
PopulateAdvancedAuxiliaries()
'Attempt to select that found in Config
End Sub
'Close - Check for unsaved changes
Private Sub F02_GEN_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
If e.CloseReason <> CloseReason.ApplicationExitCall And e.CloseReason <> CloseReason.WindowsShutDown Then
e.Cancel = ChangeCheckCancel()
End If
End Sub
'Set generic values for Declaration mode
Private Sub DeclInit()
If Not Cfg.DeclMode Then Exit Sub
LvCycles.Items.Clear()
CbEngOnly.Checked = False
TbDesMaxFile.Text = ""
If Not RdEcoRoll.Checked Then RdOverspeed.Checked = True
CbLookAhead.Checked = True
TbSSspeed.Text = DeclarationData.Driver.StartStop.MaxSpeed.AsKmph().ToGUIFormat() 'cDeclaration.SSspeed
TbSStime.Text = DeclarationData.Driver.StartStop.MinTime.ToGUIFormat() 'cDeclaration.SStime
TbSSdelay.Text = DeclarationData.Driver.StartStop.Delay.ToGUIFormat() ' cDeclaration.SSdelay
tbLacPreviewFactor.Text = DeclarationData.Driver.LookAhead.LookAheadDistanceFactor.ToGUIFormat()
tbLacDfTargetSpeedFile.Text = ""
tbLacDfVelocityDropFile.Text = ""
TbOverspeed.Text = DeclarationData.Driver.OverSpeedEcoRoll.OverSpeed.AsKmph().ToGUIFormat() 'cDeclaration.Overspeed
TbUnderSpeed.Text = DeclarationData.Driver.OverSpeedEcoRoll.UnderSpeed.AsKmph().ToGUIFormat() _
' cDeclaration.Underspeed
TbVmin.Text = DeclarationData.Driver.OverSpeedEcoRoll.MinSpeed.AsKmph().ToGUIFormat() 'cDeclaration.ECvmin
If _
LvAux.Items.Count <> 5 OrElse
(LvAux.Items(0).Text <> Constants.AuxiliaryKey.Fan OrElse LvAux.Items(1).Text <> Constants.AuxiliaryKey.SteerPump OrElse
LvAux.Items(2).Text <> Constants.AuxiliaryKey.HVAC OrElse LvAux.Items(3).Text <> Constants.AuxiliaryKey.ElecSys OrElse
LvAux.Items(4).Text <> Constants.AuxiliaryKey.PneumSys) Then
LvAux.Items.Clear()
LvAux.Items.Add(GetTechListForAux(Constants.AuxiliaryKey.Fan, "Fan", DeclarationData.Fan))
LvAux.Items.Add(GetTechListForAux(Constants.AuxiliaryKey.SteerPump, "Steering pump", DeclarationData.SteeringPump))
LvAux.Items.Add(GetTechListForAux(Constants.AuxiliaryKey.HVAC, "HVAC",
DeclarationData.HeatingVentilationAirConditioning))
LvAux.Items.Add(GetTechListForAux(Constants.AuxiliaryKey.ElecSys, "Electric System", DeclarationData.ElectricSystem))
LvAux.Items.Add(GetTechListForAux(Constants.AuxiliaryKey.PneumSys, "Pneumatic System",
DeclarationData.PneumaticSystem))
End If
End Sub

Markus QUARITSCH
committed
Protected Function GetTechListForAux(key As String, nameStr As String, aux As IDeclarationAuxiliaryTable) _
As ListViewItem
Dim LV0 As ListViewItem
LV0 = New ListViewItem(key)
LV0.SubItems.Add(nameStr)
Dim auxtech As String() = aux.GetTechnologies()
If auxtech.Count > 1 Then
LV0.SubItems.Add("")
Else
LV0.SubItems.Add(auxtech(0))
End If
Return LV0
End Function
'Show/Hide "Driver Assist" Tab
Private Sub SetDrivertab(onOff As Boolean)
If onOff Then
If Not _pgDriverOn Then
_pgDriverOn = True
TabControl1.TabPages.Insert(1, _pgDriver)
End If
Else
If _pgDriverOn Then
_pgDriverOn = False
TabControl1.Controls.Remove(_pgDriver)
End If
End If
End Sub
#Region "Browse Buttons"
Private Sub ButtonVEH_Click(sender As Object, e As EventArgs) Handles ButtonVEH.Click

Markus QUARITSCH
committed
If VehicleFileBrowser.OpenDialog(fFileRepl(TbVEH.Text, GetPath(VECTOfile))) Then
TbVEH.Text = GetFilenameWithoutDirectory(VehicleFileBrowser.Files(0), GetPath(VECTOfile))
End If
End Sub
Private Sub ButtonMAP_Click(sender As Object, e As EventArgs) Handles ButtonMAP.Click

Markus QUARITSCH
committed
If EngineFileBrowser.OpenDialog(fFileRepl(TbENG.Text, GetPath(VECTOfile))) Then
TbENG.Text = GetFilenameWithoutDirectory(EngineFileBrowser.Files(0), GetPath(VECTOfile))
End If
End Sub
Private Sub ButtonGBX_Click(sender As Object, e As EventArgs) Handles ButtonGBX.Click

Markus QUARITSCH
committed
If GearboxFileBrowser.OpenDialog(fFileRepl(TbGBX.Text, GetPath(VECTOfile))) Then
TbGBX.Text = GetFilenameWithoutDirectory(GearboxFileBrowser.Files(0), GetPath(VECTOfile))
End If
End Sub
Private Sub BtDesMaxBr_Click_1(sender As Object, e As EventArgs) Handles BtDesMaxBr.Click

Markus QUARITSCH
committed
If DriverAccelerationFileBrowser.OpenDialog(fFileRepl(TbDesMaxFile.Text, GetPath(VECTOfile))) Then
TbDesMaxFile.Text = GetFilenameWithoutDirectory(DriverAccelerationFileBrowser.Files(0), GetPath(VECTOfile))
End If
End Sub
Private Sub BtAccOpen_Click(sender As Object, e As EventArgs) Handles BtAccOpen.Click

Markus QUARITSCH
committed
OpenFiles(fFileRepl(TbDesMaxFile.Text, GetPath(VECTOfile)))
End Sub
#End Region
#Region "Open Buttons"
'Open Vehicle Editor
Private Sub ButOpenVEH_Click(sender As Object, e As EventArgs) Handles ButOpenVEH.Click
Dim f As String

Markus QUARITSCH
committed
f = fFileRepl(TbVEH.Text, GetPath(VECTOfile))
'Thus Veh-file is returned

Markus QUARITSCH
committed
VehicleForm.JobDir = GetPath(VECTOfile)
VehicleForm.AutoSendTo = True
If Not Trim(f) = "" Then
If Not File.Exists(f) Then
MsgBox("File not found!")
Exit Sub
End If
End If
If Not VehicleForm.Visible Then
VehicleForm.Show()
Else
If VehicleForm.WindowState = FormWindowState.Minimized Then VehicleForm.WindowState = FormWindowState.Normal
VehicleForm.BringToFront()
End If
If Not Trim(f) = "" Then
Try
VehicleForm.OpenVehicle(f)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OkOnly, "Error loading Vehicle File")
End Try
End If
End Sub
'Open Engine Editor
Private Sub ButOpenENG_Click(sender As Object, e As EventArgs) Handles ButOpenENG.Click
Dim f As String

Markus QUARITSCH
committed
f = fFileRepl(TbENG.Text, GetPath(VECTOfile))
'Thus Veh-file is returned

Markus QUARITSCH
committed
EngineForm.JobDir = GetPath(VECTOfile)
EngineForm.AutoSendTo = True
If Not Trim(f) = "" Then
If Not File.Exists(f) Then
MsgBox("File not found!")
Exit Sub
End If
End If
If Not EngineForm.Visible Then
EngineForm.Show()
Else
If EngineForm.WindowState = FormWindowState.Minimized Then EngineForm.WindowState = FormWindowState.Normal
EngineForm.BringToFront()
End If
If Not Trim(f) = "" Then EngineForm.OpenEngineFile(f)
End Sub
'Open Gearbox Editor
Private Sub ButOpenGBX_Click(sender As Object, e As EventArgs) Handles ButOpenGBX.Click
Dim f As String

Markus QUARITSCH
committed
f = fFileRepl(TbGBX.Text, GetPath(VECTOfile))
'Thus Veh-file is returned

Markus QUARITSCH
committed
GearboxForm.JobDir = GetPath(VECTOfile)
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
GearboxForm.AutoSendTo = True
If Not Trim(f) = "" Then
If Not File.Exists(f) Then
MsgBox("File not found!")
Exit Sub
End If
End If
If Not GearboxForm.Visible Then
GearboxForm.Show()
Else
If GearboxForm.WindowState = FormWindowState.Minimized Then GearboxForm.WindowState = FormWindowState.Normal
GearboxForm.BringToFront()
End If
If Not Trim(f) = "" Then GearboxForm.openGBX(f)
End Sub
#End Region
#Region "Toolbar"
'New
Private Sub ToolStripBtNew_Click(sender As Object, e As EventArgs) Handles ToolStripBtNew.Click
VECTOnew()
End Sub
'Open
Private Sub ToolStripBtOpen_Click(sender As Object, e As EventArgs) Handles ToolStripBtOpen.Click
If JobfileFileBrowser.OpenDialog(VECTOfile, False, "vecto") Then VECTOload2Form(JobfileFileBrowser.Files(0))
End Sub
'Save
Private Sub ToolStripBtSave_Click(sender As Object, e As EventArgs) Handles ToolStripBtSave.Click
Save()
End Sub
'Save As
Private Sub ToolStripBtSaveAs_Click(sender As Object, e As EventArgs) Handles ToolStripBtSaveAs.Click
If JobfileFileBrowser.SaveDialog(VECTOfile) Then Call VECTOsave(JobfileFileBrowser.Files(0))
End Sub
'Send to Job file list in main form
Private Sub ToolStripBtSendTo_Click(sender As Object, e As EventArgs) Handles ToolStripBtSendTo.Click
If ChangeCheckCancel() Then Exit Sub
If VECTOfile = "" Then
MsgBox("File not found!" & ChrW(10) & ChrW(10) & "Save file and try again.")
Else
MainForm.AddToJobListView(VECTOfile)
End If
End Sub
'Help
Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click
If File.Exists(MyAppPath & "User Manual\help.html") Then
Dim BrowserRegistryString As String =
My.Computer.Registry.ClassesRoot.OpenSubKey("\http\shell\open\command\").GetValue("").ToString
Dim DefaultBrowserPath As String =
Regex.Match(BrowserRegistryString, "(\"".*?\"")").Captures(0).ToString
Process.Start(DefaultBrowserPath,
String.Format("""{0}{1}""", MyAppPath, "User Manual\help.html#job-editor"))
Else
MsgBox("User Manual not found!", MsgBoxStyle.Critical)
End If
End Sub
#End Region
'Save ("Save" or "Save As" when new file)
Private Function Save() As Boolean
If VECTOfile = "" Then
If JobfileFileBrowser.SaveDialog("") Then
VECTOfile = JobfileFileBrowser.Files(0)
Else
Return False
End If
End If
Return VECTOsave(VECTOfile)
End Function
'Open file
Public Sub VECTOload2Form(file As String)
If ChangeCheckCancel() Then Exit Sub
VECTOnew()
'Read GEN
Dim VEC0 = New VectoJob
VEC0.FilePath = file
Try
If Not VEC0.ReadFile() Then

Markus QUARITSCH
committed
MsgBox("Failed to load " & GetFilenameWithoutPath(file, True) & "!")
Exit Sub
End If
Catch ex As Exception

Markus QUARITSCH
committed
MsgBox("Failed to load " & GetFilenameWithoutPath(file, True) & "!")
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
Exit Sub
End Try
If Cfg.DeclMode <> VEC0.SavedInDeclMode Then
Select Case WrongMode()
Case 1
Close()
MainForm.RbDecl.Checked = Not MainForm.RbDecl.Checked
MainForm.OpenVectoFile(file)
Case -1
Exit Sub
Case Else '0
'Continue...
End Select
End If
'Update Form
'Files -----------------------------
TbVEH.Text = VEC0.PathVeh(True)
TbENG.Text = VEC0.PathEng(True)
TbGBX.Text = VEC0.PathGbx(True)
'Start/Stop
ChBStartStop.Checked = VEC0.StartStop
TbSSspeed.Text = VEC0.StStV.ToString()
TbSStime.Text = VEC0.StStT.ToString()
TbSSdelay.Text = VEC0.StartStopDelay.ToString()
'VACC
TbDesMaxFile.Text = VEC0.DesMaxFile(True)
'AA-TB
'Try and Select any previously selected Auxiliary Type

Markus QUARITSCH
committed
For Each item As AdvancedAuxiliary In cboAdvancedAuxiliaries.Items
If item.AssemblyName = VEC0.AuxiliaryAssembly AndAlso VEC0.AuxiliaryVersion = item.AuxiliaryVersion Then
cboAdvancedAuxiliaries.SelectedItem = item
Exit For
End If
Next
'AA-TB
'Assign any previously saved Axiliary FilePath
txtAdvancedAuxiliaryFile.Text = VEC0.AdvancedAuxiliaryFilePath
LvAux.Items.Clear()
For Each AuxEntryKV In VEC0.AuxPaths
Dim lv0 = New ListViewItem
lv0.SubItems(0).Text = AuxEntryKV.Key
lv0.SubItems.Add(AuxEntryKV.Value.Type)
If Cfg.DeclMode Then
lv0.SubItems.Add(String.Join(", ", AuxEntryKV.Value.TechnologyList))
Else
lv0.SubItems.Add(AuxEntryKV.Value.Path.OriginalPath)
End If
LvAux.Items.Add(lv0)
Next
For Each sb In VEC0.CycleFiles
Dim lv0 = New ListViewItem
lv0.Text = sb.OriginalPath
LvCycles.Items.Add(lv0)
Next
CbEngOnly.Checked = VEC0.EngineOnly
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
If VEC0.EcoRollOn Then
RdEcoRoll.Checked = True
ElseIf VEC0.OverSpeedOn Then
RdOverspeed.Checked = True
Else
RdOff.Checked = True
End If
TbOverspeed.Text = CStr(VEC0.OverSpeed)
TbUnderSpeed.Text = CStr(VEC0.UnderSpeed)
TbVmin.Text = CStr(VEC0.VMin)
CbLookAhead.Checked = VEC0.LookAheadOn
'TbAlookahead.Text = CStr(VEC0.ALookahead)
'TbVminLA.Text = CStr(VEC0.VMinLa)
tbLacPreviewFactor.Text = CStr(VEC0.LacPreviewFactor)
tbDfCoastingOffset.Text = CStr(VEC0.LacDfOffset)
tbDfCoastingScale.Text = CStr(VEC0.LacDfScale)
tbLacDfTargetSpeedFile.Text = VEC0.LacDfTargetSpeedFile
tbLacDfVelocityDropFile.Text = VEC0.LacDfVelocityDropFile
'-------------------------------------------------------------
DeclInit()
EngineForm.AutoSendTo = False
GearboxForm.AutoSendTo = False
VehicleForm.AutoSendTo = False
VECTOfile = file
Dim x As Integer = Len(file)
While Mid(file, x, 1) <> "\" And x > 0
x = x - 1
End While
Text = Mid(file, x + 1, Len(file) - x)
_changed = False
ToolStripStatusLabelGEN.Text = "" 'file & " opened."
UpdatePic()
'-------------------------------------------------------------
End Sub
'Save file
Private Function VECTOsave(file As String) As Boolean
Dim message As String = String.Empty
'AA-TB
'Validation of Auxiliary Types/Advanced Auxiliaries
'if not classic, check the file is valid, if not fail the operation and alert user.
If cboAdvancedAuxiliaries.SelectedIndex > 0 Then
'resolve absolute path for auxiliary file.

Markus QUARITSCH
committed
Dim absoluteAAUxFile = ResolveAAUXFilePath(GetPath(VECTOfile), txtAdvancedAuxiliaryFile.Text)

Markus QUARITSCH
committed
Dim aaAssemblyName = DirectCast(cboAdvancedAuxiliaries.SelectedItem, AdvancedAuxiliary).AssemblyName
Dim aaAssemblyVersion = DirectCast(cboAdvancedAuxiliaries.SelectedItem, AdvancedAuxiliary).AuxiliaryVersion
If Not ValidateAAUXFile(absoluteAAUxFile, aaAssemblyName, aaAssemblyVersion, message) Then
MessageBox.Show(
String.Format("You have selected an advanced auxiliary *Auxiliary Type*, but the file specified is invalid :{0}",
message))
Return False
End If
End If
Dim vec0 = New VectoJob
vec0.FilePath = file
'Files ------------------------------------------------- -----------------
vec0.PathVeh = TbVEH.Text
vec0.PathEng = TbENG.Text
For Each lv0 As ListViewItem In LvCycles.Items
Dim sb = New SubPath

Markus QUARITSCH
committed
sb.Init(GetPath(file), lv0.Text)
vec0.CycleFiles.Add(sb)
Next
vec0.PathGbx = TbGBX.Text
'Start/Stop
vec0.StartStop = ChBStartStop.Checked
vec0.StStV = TbSSspeed.Text.ToDouble()
vec0.StStT = TbSStime.Text.ToDouble()
vec0.StartStopDelay = TbSSdelay.Text.ToDouble()
'a_DesMax
vec0.DesMaxFile = TbDesMaxFile.Text
'AA-TB

Markus QUARITSCH
committed
vec0.AuxiliaryAssembly = DirectCast(cboAdvancedAuxiliaries.SelectedItem, AdvancedAuxiliary).AssemblyName
vec0.AuxiliaryVersion = DirectCast(cboAdvancedAuxiliaries.SelectedItem, AdvancedAuxiliary).AuxiliaryVersion
vec0.AdvancedAuxiliaryFilePath = txtAdvancedAuxiliaryFile.Text
For Each lv0 As ListViewItem In LvAux.Items
Dim auxEntry = New VectoJob.AuxEntry
If Cfg.DeclMode Then
auxEntry.TechnologyList.Clear()
auxEntry.TechnologyList.Add(lv0.SubItems(2).Text)

Markus QUARITSCH
committed
auxEntry.Path.Init(GetPath(file), lv0.SubItems(2).Text)
End If
auxEntry.Type = lv0.SubItems(1).Text
vec0.AuxPaths.Add(lv0.SubItems(0).Text, auxEntry)
Next
vec0.EngineOnly = CbEngOnly.Checked
vec0.EcoRollOn = RdEcoRoll.Checked
vec0.OverSpeedOn = RdOverspeed.Checked
vec0.OverSpeed = TbOverspeed.Text.ToDouble()
vec0.UnderSpeed = TbUnderSpeed.Text.ToDouble()
vec0.VMin = TbVmin.Text.ToDouble()
vec0.LookAheadOn = CbLookAhead.Checked
'vec0.ALookahead = CSng(fTextboxToNumString(TbAlookahead.Text))
'vec0.VMinLa = CSng(fTextboxToNumString(TbVminLA.Text))
vec0.LacPreviewFactor = tbLacPreviewFactor.Text.ToDouble()
vec0.LacDfOffset = tbDfCoastingOffset.Text.ToDouble()
vec0.LacDfScale = tbDfCoastingScale.Text.ToDouble()
vec0.LacDfTargetSpeedFile = tbLacDfTargetSpeedFile.Text
vec0.LacDfVelocityDropFile = tbLacDfVelocityDropFile.Text
'------------------------------------------------------------
'SAVE
If Not vec0.SaveFile Then
MsgBox("Cannot safe to " & file, MsgBoxStyle.Critical)
Return False
End If
VECTOfile = file

Markus QUARITSCH
committed
file = GetFilenameWithoutPath(VECTOfile, True)
Text = file
ToolStripStatusLabelGEN.Text = ""
MainForm.AddToJobListView(VECTOfile)
_changed = False
Return True
End Function
'New file
Public Sub VECTOnew()
If ChangeCheckCancel() Then Exit Sub
EngineIdleSpeed = -1
EngineFullLoadFile = ""
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
'Files
TbVEH.Text = ""
TbENG.Text = ""
LvCycles.Items.Clear()
TbGBX.Text = ""
TbDesMaxFile.Text = ""
'Start/Stop
TbSSspeed.Text = "5"
TbSStime.Text = "5"
ChBStartStop.Checked = False
LvAux.Items.Clear()
CbEngOnly.Checked = False
RdOff.Checked = True
CbLookAhead.Checked = True
'TbAlookahead.Text = "-0.5"
TbOverspeed.Text = ""
TbUnderSpeed.Text = ""
TbVmin.Text = ""
'TbVminLA.Text = "50"
tbLacPreviewFactor.Text = "10"
tbDfCoastingOffset.Text = "2.5"
tbDfCoastingScale.Text = "1.5"
tbLacDfTargetSpeedFile.Text = ""
tbLacDfVelocityDropFile.Text = ""
'---------------------------------------------------
DeclInit()
EngineForm.AutoSendTo = False
VECTOfile = ""
Text = "Job Editor"
ToolStripStatusLabelGEN.Text = ""
_changed = False
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
UpdatePic()
End Sub
#Region "Track changes"
#Region "'Change' Events"
Private Sub TextBoxVEH_TextChanged(sender As Object, e As EventArgs) _
Handles TbVEH.TextChanged
UpdatePic()
Change()
End Sub
Private Sub TextBoxMAP_TextChanged(sender As Object, e As EventArgs) _
Handles TbENG.TextChanged
UpdatePic()
Change()
End Sub
Private Sub TextBoxFLD_TextChanged(sender As Object, e As EventArgs) _
Handles TbGBX.TextChanged
UpdatePic()
Change()
End Sub
Private Sub TbDesMaxFile_TextChanged_1(sender As Object, e As EventArgs) Handles TbDesMaxFile.TextChanged
Change()
End Sub
Private Sub TBSSspeed_TextChanged(sender As Object, e As EventArgs) Handles TbSSspeed.TextChanged
Change()
End Sub
Private Sub TBSStime_TextChanged(sender As Object, e As EventArgs) _
Handles TbSStime.TextChanged, TbSSdelay.TextChanged
Change()
End Sub
Private Sub TbOverspeed_TextChanged(sender As Object, e As EventArgs) Handles TbOverspeed.TextChanged
Change()
End Sub
Private Sub TbUnderSpeed_TextChanged(sender As Object, e As EventArgs) Handles TbUnderSpeed.TextChanged
Change()
End Sub
Private Sub TbVmin_TextChanged(sender As Object, e As EventArgs) _
Handles TbVmin.TextChanged
Change()
End Sub
Private Sub LvCycles_AfterLabelEdit(sender As Object, e As LabelEditEventArgs) _
Handles LvCycles.AfterLabelEdit
Change()
End Sub
#End Region
Private Sub Change()
If Not _changed Then
ToolStripStatusLabelGEN.Text = "Unsaved changes in current file"
_changed = True
End If
End Sub
' "Save changes? "... Returns True if User aborts
Private Function ChangeCheckCancel() As Boolean
If _changed Then
Select Case MsgBox("Save changes ?", MsgBoxStyle.YesNoCancel)
Case MsgBoxResult.Yes
Return Not Save()
Case MsgBoxResult.Cancel
Return True
Case Else 'MsgBoxResult.No
_changed = False
Return False
End Select
Else
Return False
End If
End Function
#End Region
#Region "Aux Listview"
Private Sub ButAuxAdd_Click(sender As Object, e As EventArgs) Handles ButAuxAdd.Click
Dim ID As String
_auxDialog.VehPath = GetPath(VECTOfile)
_auxDialog.TbPath.Text = ""
_auxDialog.CbType.SelectedIndex = -1
_auxDialog.CbType.Text = ""
_auxDialog.TbID.Text = "" '!!! Set Type before ID, because changing the type will overwrite the id !!!
If _auxDialog.ShowDialog = DialogResult.OK Then
ID = UCase(Trim(_auxDialog.TbID.Text))
Dim lv0 As ListViewItem
For Each lv0 In LvAux.Items
If lv0.SubItems(0).Text = ID Then
MsgBox("ID '" & ID & "' already defined!", MsgBoxStyle.Critical)
_auxDialog.TbID.SelectAll()
_auxDialog.TbID.Focus()
GoTo lbDlog
End If
Next
lv0 = New ListViewItem
lv0.SubItems(0).Text = UCase(Trim(_auxDialog.TbID.Text))
lv0.SubItems.Add(Trim(_auxDialog.CbType.Text))
lv0.SubItems.Add(Trim(_auxDialog.TbPath.Text))
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
LvAux.Items.Add(lv0)
Change()
End If
End Sub
Private Sub ButAuxRem_Click(sender As Object, e As EventArgs) Handles ButAuxRem.Click
RemoveAuxItem()
End Sub
Private Sub LvAux_DoubleClick(sender As Object, e As EventArgs) Handles LvAux.DoubleClick
EditAuxItem()
End Sub
Private Sub LvAux_KeyDown(sender As Object, e As KeyEventArgs) Handles LvAux.KeyDown
Select Case e.KeyCode
Case Keys.Delete, Keys.Back
If Not Cfg.DeclMode Then RemoveAuxItem()
Case Keys.Enter
EditAuxItem()
End Select
End Sub
Private Sub EditAuxItem()
If LvAux.SelectedItems.Count = 0 Then
Exit Sub
End If
Dim selItem = LvAux.SelectedItems(0)
_auxDialog.VehPath = GetPath(VECTOfile)
_auxDialog.CbType.SelectedIndex = -1
_auxDialog.CbType.Text = selItem.SubItems(1).Text
_auxDialog.TbID.Text = selItem.SubItems(0).Text 'After Type-set!
If Cfg.DeclMode Then
_auxDialog.CbTech.Text = selItem.SubItems(2).Text
_auxDialog.TbPath.Text = ""
_auxDialog.CbTech.SelectedIndex = -1
_auxDialog.TbPath.Text = selItem.SubItems(2).Text
If _auxDialog.ShowDialog = DialogResult.OK Then
selItem.SubItems(0).Text = UCase(Trim(_auxDialog.TbID.Text))
selItem.SubItems(1).Text = Trim(_auxDialog.CbType.Text)
If Cfg.DeclMode Then
selItem.SubItems(2).Text = Trim(_auxDialog.CbTech.Text)
selItem.SubItems(2).Text = Trim(_auxDialog.TbPath.Text)
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
End If
Change()
End If
End Sub
Private Sub RemoveAuxItem()
Dim i As Integer
If LvAux.SelectedItems.Count = 0 Then
If LvAux.Items.Count = 0 Then
Exit Sub
Else
LvAux.Items(LvAux.Items.Count - 1).Selected = True
End If
End If
i = LvAux.SelectedItems(0).Index
LvAux.SelectedItems(0).Remove()
If LvAux.Items.Count > 0 Then
If i < LvAux.Items.Count Then
LvAux.Items(i).Selected = True
Else
LvAux.Items(LvAux.Items.Count - 1).Selected = True
End If
LvAux.Focus()
End If
Change()
End Sub
#End Region
'OK (Save & Close)
Private Sub ButSave_Click(sender As Object, e As EventArgs) Handles ButOK.Click
If Not Save() Then Exit Sub
Close()
End Sub
'Cancel
Private Sub ButCancel_Click(sender As Object, e As EventArgs) Handles ButCancel.Click
Close()
End Sub
#Region "Cycle list"
Private Sub LvCycles_DoubleClick(sender As Object, e As EventArgs) Handles LvCycles.DoubleClick
If LvCycles.SelectedItems.Count > 0 Then _

Markus QUARITSCH
committed
OpenFiles(fFileRepl(LvCycles.SelectedItems(0).SubItems(0).Text, GetPath(VECTOfile)))
End Sub
Private Sub LvCycles_KeyDown(sender As Object, e As KeyEventArgs) Handles LvCycles.KeyDown
Select Case e.KeyCode
Case Keys.Delete, Keys.Back
RemoveCycle()
Case Keys.Enter
If LvCycles.SelectedItems.Count > 0 Then LvCycles.SelectedItems(0).BeginEdit()
End Select
End Sub
Private Sub BtDRIadd_Click(sender As Object, e As EventArgs) Handles BtDRIadd.Click

Markus QUARITSCH
committed
Dim genDir As String = GetPath(VECTOfile)
If DrivingCycleFileBrowser.OpenDialog("", True) Then
For Each s In DrivingCycleFileBrowser.Files

Markus QUARITSCH
committed
LvCycles.Items.Add(GetFilenameWithoutDirectory(s, genDir))
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
Next
Change()
End If
End Sub
Private Sub BtDRIrem_Click(sender As Object, e As EventArgs) Handles BtDRIrem.Click
RemoveCycle()
End Sub
Private Sub RemoveCycle()
Dim i As Integer
If LvCycles.SelectedItems.Count = 0 Then
If LvCycles.Items.Count = 0 Then
Exit Sub
Else
LvCycles.Items(LvCycles.Items.Count - 1).Selected = True
End If
End If
i = LvCycles.SelectedItems(0).Index
LvCycles.SelectedItems(0).Remove()
If LvCycles.Items.Count > 0 Then
If i < LvCycles.Items.Count Then
LvCycles.Items(i).Selected = True
Else
LvCycles.Items(LvCycles.Items.Count - 1).Selected = True
End If
LvCycles.Focus()
End If
Change()
End Sub
#End Region
#Region "Enable/Disable GUI controls"
'Engine only mode changed
Private Sub CbEngOnly_CheckedChanged(sender As Object, e As EventArgs) Handles CbEngOnly.CheckedChanged
CheckEngOnly()
Change()
End Sub
Private Sub CheckEngOnly()
Dim OnOff As Boolean
OnOff = Not CbEngOnly.Checked
SetDrivertab(OnOff)
ButOpenVEH.Enabled = OnOff
TbVEH.Enabled = OnOff
ButtonVEH.Enabled = OnOff
ButOpenGBX.Enabled = OnOff
TbGBX.Enabled = OnOff
ButtonGBX.Enabled = OnOff
GrAux.Enabled = OnOff
End Sub
'Start/Stop changed
Private Sub ChBStartStop_CheckedChanged_1(sender As Object, e As EventArgs) _
Handles ChBStartStop.CheckedChanged
Change()
If Not Cfg.DeclMode Then PnStartStop.Enabled = ChBStartStop.Checked
End Sub
'LAC changed
Private Sub CbLookAhead_CheckedChanged(sender As Object, e As EventArgs) _
Handles CbLookAhead.CheckedChanged
Change()
End Sub
'EcoRoll / Overspeed changed
Private Sub RdOff_CheckedChanged(sender As Object, e As EventArgs) _
Handles RdOff.CheckedChanged, RdOverspeed.CheckedChanged, RdEcoRoll.CheckedChanged
Dim EcoR As Boolean
Dim Ovr As Boolean
Change()
EcoR = RdEcoRoll.Checked
Ovr = RdOverspeed.Checked
TbOverspeed.Enabled = Ovr Or EcoR
Label13.Enabled = Ovr Or EcoR
Label14.Enabled = Ovr Or EcoR
TbUnderSpeed.Enabled = EcoR
Label22.Enabled = EcoR
Label20.Enabled = EcoR
TbVmin.Enabled = Ovr Or EcoR
Label23.Enabled = Ovr Or EcoR
Label21.Enabled = Ovr Or EcoR
End Sub
#End Region
Public Sub UpdatePic()
Dim i As Integer
Dim pmax As Double
Dim f As CsvFile
Dim lM As List(Of Single)
Dim lup As List(Of Single)
Dim ldown As List(Of Single)
Dim line As String()
Dim HDVclass As String
Dim s As Series
Dim a As ChartArea
Dim img As Bitmap
Dim EngOK = False
TbHVCclass.Text = ""
TbVehCat.Text = ""
TbMass.Text = ""
TbAxleConf.Text = ""
TbEngTxt.Text = ""
TbGbxTxt.Text = ""
PicVehicle.Image = Nothing
PicBox.Image = Nothing
Dim inputData As IEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadComponentData(TbVEH.Text),
IEngineeringInputDataProvider)
Dim vehicle = inputData.VehicleInputData
If Not vehicle Is Nothing Then
Dim maxMass = vehicle.GrossVehicleMassRating 'CSng(fTextboxToNumString(TbMassMass.Text))
Dim s0 As Segment = Nothing
Try
s0 = DeclarationData.Segments.Lookup(vehicle.VehicleCategory, vehicle.AxleConfiguration, maxMass, 0.SI(Of Kilogram), True)
Catch
End Try
If Not s0 Is Nothing Then
HDVclass = s0.VehicleClass.GetClassNumber()
If Cfg.DeclMode Then
LvCycles.Items.Clear()
For Each m0 In s0.Missions
LvCycles.Items.Add(m0.MissionType.ToString())
Next
End If
Else
HDVclass = "-"
End If
PicVehicle.Image = ConvPicPath(If(s0 Is Nothing, -1, HDVclass.ToInt()), False) _
'Image.FromFile(cDeclaration.ConvPicPath(HDVclass, False))
TbHVCclass.Text = "HDV Class " & HDVclass
TbVehCat.Text = vehicle.VehicleCategory.GetCategoryName() 'ConvVehCat(VEH0.VehCat, True)
TbMass.Text = (vehicle.GrossVehicleMassRating.Value() / 1000) & " t"
TbAxleConf.Text = vehicle.AxleConfiguration.GetName() 'ConvAxleConf(VEH0.AxleConf)
End If
Dim OkCount = 0
Dim ENG0 = New Engine

Markus QUARITSCH
committed
ENG0.FilePath = fFileRepl(TbENG.Text, GetPath(VECTOfile))
'Create plot
Dim MyChart = New Chart
MyChart.Width = PicBox.Width
MyChart.Height = PicBox.Height
a = New ChartArea
Dim FLD0 = New EngineFullLoadCurve
If ENG0.ReadFile(False) Then
EngineIdleSpeed = ENG0.IdleSpeed
EngineFullLoadFile = ENG0.PathFLD
EngOK = True
FLD0.FilePath = ENG0.PathFLD
If FLD0.ReadFile(False, False) Then
s = New Series
s.Points.DataBindXY(FLD0.EngineSpeedList, FLD0.MaxTorqueList)
s.ChartType = SeriesChartType.FastLine
s.BorderWidth = 2
s.Color = Color.DarkBlue
s.Name = "Full load"
MyChart.Series.Add(s)
s = New Series
s.Points.DataBindXY(FLD0.EngineSpeedList, FLD0.DragTorqueList)
s.ChartType = SeriesChartType.FastLine
s.BorderWidth = 2
s.Color = Color.Blue
s.Name = "Motoring"
MyChart.Series.Add(s)
OkCount += 1
pmax = FLD0.Pfull(FLD0.EngineRatedSpeed)
End If

Markus QUARITSCH
committed
TbEngTxt.Text = (ENG0.Displacement / 1000).ToString("0.0") & " l " & pmax.ToString("#") & " kW " & ENG0.ModelName
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
Dim MAP0 = New FuelconsumptionMap
MAP0.FilePath = ENG0.PathMAP
If MAP0.ReadFile(False) Then
s = New Series
s.Points.DataBindXY(MAP0.nU, MAP0.Tq)
s.ChartType = SeriesChartType.Point
s.MarkerSize = 3
s.Color = Color.Red
s.Name = "Map"
MyChart.Series.Add(s)
OkCount += 1
End If
End If
Dim GBX0 = New Gearbox

Markus QUARITSCH
committed
GBX0.FilePath = fFileRepl(TbGBX.Text, GetPath(VECTOfile))
If GBX0.ReadFile(False) Then
TbGbxTxt.Text = GBX0.GearCount & "-Speed " & GBX0.Type.ShortName() & " " & GBX0.ModelName
If Cfg.DeclMode Then
If EngOK Then
For i = 1 To GBX0.GearCount
FLD0.FilePath = ENG0.PathFLD
If FLD0.ReadFile(True, False) Then
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
'If FLD0.Init(ENG0.Nidle) Then '' use engine from below...
'Dim engine As CombustionEngineData = ConvertToEngineData(FLD0, F_VECTO.n_idle)
'Dim shiftLines As ShiftPolygon = DeclarationData.Gearbox.ComputeShiftPolygon(Gear - 1,
' engine.FullLoadCurve, gears,
' engine,
' Double.Parse(LvGears.Items(0).SubItems(F_GBX.GearboxTbl.Ratio).Text,
' CultureInfo.InvariantCulture),
' (.rdyn / 1000.0).SI(Of Meter))
's = New Series
's.Points.DataBindXY(shiftLines.Upshift.Select(Function(pt) pt.AngularSpeed.Value() / Constants.RPMToRad).ToList(),
' shiftLines.Upshift.Select(Function(pt) pt.Torque.Value()).ToList())
's.ChartType = SeriesChartType.FastLine
's.BorderWidth = 2
's.Color = Color.DarkRed
's.Name = "Upshift curve (" & i & ")"
'MyChart.Series.Add(s)
's = New Series
's.Points.DataBindXY(
' shiftLines.Downshift.Select(Function(pt) pt.AngularSpeed.Value() / Constants.RPMToRad).ToList(),
' shiftLines.Downshift.Select(Function(pt) pt.Torque.Value()).ToList())
's.ChartType = SeriesChartType.FastLine
's.BorderWidth = 2
's.Color = Color.DarkRed
's.Name = "Downshift curve (" & i & ")"
'MyChart.Series.Add(s)
'End If
OkCount += 1
pmax = FLD0.Pfull(FLD0.EngineRatedSpeed)
End If
Next
End If
Else
f = New CsvFile
For i = 1 To GBX0.GearCount
lM = New List(Of Single)
lup = New List(Of Single)
ldown = New List(Of Single)
If f.OpenRead(GBX0.ShiftPolygonFile(i)) Then
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
f.ReadLine()
Try
Do While Not f.EndOfFile
line = f.ReadLine
lM.Add(CSng(line(0)))
lup.Add(CSng(line(1)))
ldown.Add(CSng(line(2)))
Loop
s = New Series
s.Points.DataBindXY(lup, lM)
s.ChartType = SeriesChartType.FastLine
s.BorderWidth = 2
s.Color = Color.DarkRed
s.Name = "Upshift curve"
' MyChart.Series.Add(s) 'MQ 2016-06-20: do not plot shift lines in engine dialog
s = New Series
s.Points.DataBindXY(ldown, lM)
s.ChartType = SeriesChartType.FastLine
s.BorderWidth = 2
s.Color = Color.DarkRed
s.Name = "Downshift curve"
'MyChart.Series.Add(s) 'MQ 2016-06-20:do not plot shift lines in engine dialog
OkCount += 1
f.Close()
Catch ex As Exception
f.Close()
End Try
End If
Next
End If
End If
If OkCount > 0 Then
a.Name = "main"
a.AxisX.Title = "engine speed [1/min]"
a.AxisX.TitleFont = New Font("Helvetica", 10)
a.AxisX.LabelStyle.Font = New Font("Helvetica", 8)
a.AxisX.LabelAutoFitStyle = LabelAutoFitStyles.None
a.AxisX.MajorGrid.LineDashStyle = ChartDashStyle.Dot
a.AxisY.Title = "engine torque [Nm]"
a.AxisY.TitleFont = New Font("Helvetica", 10)
a.AxisY.LabelStyle.Font = New Font("Helvetica", 8)
a.AxisY.LabelAutoFitStyle = LabelAutoFitStyles.None
a.AxisY.MajorGrid.LineDashStyle = ChartDashStyle.Dot
a.AxisX.Minimum = 300
a.BorderDashStyle = ChartDashStyle.Solid
a.BorderWidth = 1
a.BackColor = Color.GhostWhite
MyChart.ChartAreas.Add(a)
MyChart.Update()
img = New Bitmap(MyChart.Width, MyChart.Height, PixelFormat.Format32bppArgb)
MyChart.DrawToBitmap(img, New Rectangle(0, 0, PicBox.Width, PicBox.Height))
PicBox.Image = img
End If
End Sub
#Region "Open File Context Menu"
Private CmFiles As String()
Private Sub OpenFiles(ParamArray files() As String)
If files.Length = 0 Then Exit Sub
CmFiles = files
OpenWithToolStripMenuItem.Text = "Open with " & Cfg.OpenCmdName
CmOpenFile.Show(Windows.Forms.Cursor.Position)
End Sub
Private Sub OpenWithToolStripMenuItem_Click(sender As Object, e As EventArgs) _
Handles OpenWithToolStripMenuItem.Click
If Not FileOpenAlt(CmFiles(0)) Then MsgBox("Failed to open file!")
End Sub
Private Sub ShowInFolderToolStripMenuItem_Click(sender As Object, e As EventArgs) _
Handles ShowInFolderToolStripMenuItem.Click
If File.Exists(CmFiles(0)) Then
Try
Process.Start("explorer", "/select,""" & CmFiles(0) & "")
Catch ex As Exception
MsgBox("Failed to open file!")
End Try
Else
MsgBox("File not found!")
End If
End Sub
#End Region
'AA-TB
Private Sub picAuxInfo_MouseEnter(sender As Object, e As EventArgs) Handles picAuxInfo.MouseEnter
If cboAdvancedAuxiliaries.SelectedIndex = -1 Then Exit Sub
'Get tooltip

Markus QUARITSCH
committed
Dim item As AdvancedAuxiliary

Markus QUARITSCH
committed
item = DirectCast(cboAdvancedAuxiliaries.SelectedItem, AdvancedAuxiliary)
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
If item.AuxiliaryVersion = "CLASSIC" Then
ToolTip1.ToolTipTitle = "Classic Vecto Auxiliaries"
ToolTip1.SetToolTip(picAuxInfo, "Uses original basic auxiliaries calculation")
Else
ToolTip1.ToolTipTitle = "Advanced Auxiliary Information"
ToolTip1.SetToolTip(picAuxInfo, item.AuxiliaryName & " : Version=" & item.AuxiliaryVersion)
End If
End Sub
'AA-TB
Private Sub btnBrowseAAUXFile_Click(sender As Object, e As EventArgs) Handles btnBrowseAAUXFile.Click
If String.IsNullOrEmpty(VECTOfile) Then
MessageBox.Show(
"Please complete and save a valid new .vecto file before adding/configuring advanced bus auxiliaries.")
Return
End If
Dim aauxFileValidated As Boolean = False
Dim fbAux As New FileBrowser("aaux", True, False)
Dim message As String = String.Empty
Dim absoluteAuxPath As String

Markus QUARITSCH
committed
Dim assembly As AdvancedAuxiliary
'If Classic is selected, then bail
If cboAdvancedAuxiliaries.SelectedIndex = 0 Then Return
'Get Absolute Path for AAUX FILE.

Markus QUARITSCH
committed
absoluteAuxPath = ResolveAAUXFilePath(GetPath(VECTOfile), txtAdvancedAuxiliaryFile.Text)
'Set Extensions
fbAux.Extensions = New String() {"AAUX"}
Try

Markus QUARITSCH
committed
assembly = DirectCast(cboAdvancedAuxiliaries.SelectedItem, AdvancedAuxiliary)
Dim validAAUXFile As Boolean = ValidateAAUXFile(absoluteAuxPath, assembly.AssemblyName,
assembly.AuxiliaryVersion, message)
Dim fileExists As Boolean = File.Exists(absoluteAuxPath)
If fileExists AndAlso validAAUXFile Then
ConfigureAdvancedAuxiliaries(assembly.AssemblyName, assembly.AuxiliaryVersion,
txtAdvancedAuxiliaryFile.Text, VECTOfile)
Else
Dim needToFindOrCreateFile As Boolean = True
While needToFindOrCreateFile
'Find / Create file and configure.
If fbAux.CustomDialog(absoluteAuxPath, False, False, FileBrowserFileExtensionMode.ForceExt, False, String.Empty) _
Then

Markus QUARITSCH
committed
txtAdvancedAuxiliaryFile.Text = GetFilenameWithoutDirectory(fbAux.Files(0), GetPath(VECTOfile))
assembly = DirectCast(cboAdvancedAuxiliaries.SelectedItem, AdvancedAuxiliary)

Markus QUARITSCH
committed
File.Exists(ResolveAAUXFilePath(GetPath(VECTOfile), txtAdvancedAuxiliaryFile.Text)) OrElse
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
MsgBox("Do you want to create a new .AAUX file?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
needToFindOrCreateFile = False
ConfigureAdvancedAuxiliaries(assembly.AssemblyName, assembly.AuxiliaryVersion,
txtAdvancedAuxiliaryFile.Text, VECTOfile)
End If
Else
needToFindOrCreateFile = False
End If
End While
End If
Catch ex As Exception
MessageBox.Show("There was an error configuring your Advanced Auxiliary File")
End Try
End Sub
'AA-TB
Private Sub cboAdvancedAuxiliaries_SelectedIndexChanged(sender As Object, e As EventArgs) _
Handles cboAdvancedAuxiliaries.SelectedIndexChanged
'Enable or otherwise the text box and browser button associated with Advanced Axuiliaries
If cboAdvancedAuxiliaries.SelectedIndex = 0 Then
btnBrowseAAUXFile.Enabled = False
txtAdvancedAuxiliaryFile.Enabled = False
Else
btnBrowseAAUXFile.Enabled = True
txtAdvancedAuxiliaryFile.Enabled = True
End If
End Sub
'AA-TB
Private Sub btnAAUXOpen_Click(sender As Object, e As EventArgs) Handles btnAAUXOpen.Click

Markus QUARITSCH
committed
OpenFiles(fFileRepl(txtAdvancedAuxiliaryFile.Text, GetPath(VECTOfile)))
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnDfTargetSpeed.Click

Markus QUARITSCH
committed
If DriverDecisionFactorTargetSpeedFileBrowser.OpenDialog(fFileRepl(tbLacDfTargetSpeedFile.Text, GetPath(VECTOfile))) _
Then _
tbLacDfTargetSpeedFile.Text = GetFilenameWithoutDirectory(DriverDecisionFactorTargetSpeedFileBrowser.Files(0),
GetPath(VECTOfile))
End Sub
End Class