'Option Strict Off
'Option Explicit On
Imports VB = Microsoft.VisualBasic

Public Module modMxDisplaySettings

	'=========================================================

    Public MxDevice As MiniX_Constant

    'holds Mini-X Fixed Constant values for Display Setup
    Public Structure MiniX_Constant
        Dim lTubeTypeID As Integer ' Tube Type Identifier Index
        Dim dblHighVoltageConversionFactor As Double ' High Voltage Conversion Factor
        Dim dblHighVoltageMin As Double ' High Voltage Min
        Dim dblHighVoltageMax As Double ' High Voltage Max
        Dim dblDefaultdblHighVoltage As Double ' Default High Voltage kV
        Dim dblCurrentMin As Double ' Current Min
        Dim dblCurrentMax As Double ' Current Max
        Dim dblDefaultCurrent As Double ' Default Current
        Dim dblWattageMax As Double ' Wattage Max
        Dim strTubeType As String ' Tube Type Name
        Dim strControllerType As String ' Controller Type Name
        Dim strCtrlTypeID As String ' Controller Type Short Name
    End Structure

    Public Sub ReadMiniXSetup40kvMiniX(ByRef MiniXConstant As MiniX_Constant)
        MiniXConstant.strTubeType = "Mini-X 40kV 4W" ' Tube Type Name
        MiniXConstant.lTubeTypeID = -1 ' Tube Type Identifier Index
        MiniXConstant.strControllerType = "Mini-X Controller" ' Controller Type Name
        MiniXConstant.strCtrlTypeID = "Mini-X" ' Controller Type Short Name
        MiniXConstant.dblHighVoltageConversionFactor = 10.0 ' High Voltage Conversion Factor
        MiniXConstant.dblHighVoltageMin = 10.0 ' High Voltage Min
        MiniXConstant.dblHighVoltageMax = 40.0 ' High Voltage Max
        MiniXConstant.dblDefaultdblHighVoltage = 15.0 ' Default High Voltage kV
        MiniXConstant.dblCurrentMin = 5.0 ' Current Min
        MiniXConstant.dblCurrentMax = 200.0 ' Current Max
        MiniXConstant.dblDefaultCurrent = 15.0 ' Default Current
        MiniXConstant.dblWattageMax = 4.0 ' Wattage Max
    End Sub

    Public Sub ReadMiniXSetup50kvMiniX(ByRef MiniXConstant As MiniX_Constant)
        MiniXConstant.strTubeType = "Mini-X 50kV 4W" ' Tube Type Name
        MiniXConstant.lTubeTypeID = 3 ' Tube Type Identifier Index
        MiniXConstant.strControllerType = "Mini-X Controller" ' Controller Type Name
        MiniXConstant.strCtrlTypeID = "Mini-X" ' Controller Type Short Name
        MiniXConstant.dblHighVoltageConversionFactor = 12.5 ' High Voltage Conversion Factor
        MiniXConstant.dblHighVoltageMin = 10.0 ' High Voltage Min
        MiniXConstant.dblHighVoltageMax = 50.0 ' High Voltage Max
        MiniXConstant.dblDefaultdblHighVoltage = 15.0 ' Default High Voltage kV
        MiniXConstant.dblCurrentMin = 5.0 ' Current Min
        MiniXConstant.dblCurrentMax = 200.0 ' Current Max
        MiniXConstant.dblDefaultCurrent = 15.0 ' Default Current
        MiniXConstant.dblWattageMax = 4.0 ' Wattage Max
    End Sub

    Public Sub ReadMiniXSetup50kv4W_OEM(ByRef MiniXConstant As MiniX_Constant)
        MiniXConstant.strTubeType = "Mini-X-OEM 50kV 4W" ' Tube Type Name
        MiniXConstant.lTubeTypeID = 1 ' Tube Type Identifier Index
        MiniXConstant.strControllerType = "MX50 USB Controller" ' Controller Type Name
        MiniXConstant.strCtrlTypeID = "MX50" ' Controller Type Short Name
        MiniXConstant.dblHighVoltageConversionFactor = 12.5 ' High Voltage Conversion Factor
        MiniXConstant.dblHighVoltageMin = 10.0 ' High Voltage Min
        MiniXConstant.dblHighVoltageMax = 50.0 ' High Voltage Max
        MiniXConstant.dblDefaultdblHighVoltage = 15.0 ' Default High Voltage kV
        MiniXConstant.dblCurrentMin = 5.0 ' Current Min
        MiniXConstant.dblCurrentMax = 200.0 ' Current Max
        MiniXConstant.dblDefaultCurrent = 15.0 ' Default Current
        MiniXConstant.dblWattageMax = 4.0 ' Wattage Max
    End Sub

    Public Sub ReadMiniXSetup50kv10W_OEM(ByRef MiniXConstant As MiniX_Constant)
        MiniXConstant.strTubeType = "Mini-X-OEM 50kV 10W" ' Tube Type Name
        MiniXConstant.lTubeTypeID = 2 ' Tube Type Identifier Index
        MiniXConstant.strControllerType = "MX50.10 USB Controller" ' Controller Type Name
        MiniXConstant.strCtrlTypeID = "MX50.10" ' Controller Type Short Name
        MiniXConstant.dblHighVoltageConversionFactor = 12.5 ' High Voltage Conversion Factor
        MiniXConstant.dblHighVoltageMin = 10.0 ' High Voltage Min
        MiniXConstant.dblHighVoltageMax = 50.0 ' High Voltage Max
        MiniXConstant.dblDefaultdblHighVoltage = 15.0 ' Default High Voltage kV
        MiniXConstant.dblCurrentMin = 5.0 ' Current Min
        MiniXConstant.dblCurrentMax = 200.0 ' Current Max
        MiniXConstant.dblDefaultCurrent = 15.0 ' Default Current
        MiniXConstant.dblWattageMax = 10.0 ' Wattage Max
    End Sub

    Public Sub ReadMiniXSetup70kv10W_OEM(ByRef MiniXConstant As MiniX_Constant)
        MiniXConstant.strTubeType = "Mini-X-OEM 70kV 10W" ' Tube Type Name
        MiniXConstant.lTubeTypeID = 0 ' Tube Type Identifier Index
        MiniXConstant.strControllerType = "MX70 USB Controller" ' Controller Type Name
        MiniXConstant.strCtrlTypeID = "MX70" ' Controller Type Short Name
        MiniXConstant.dblHighVoltageConversionFactor = 20.0 ' High Voltage Conversion Factor
        MiniXConstant.dblHighVoltageMin = 35.0 ' High Voltage Min
        MiniXConstant.dblHighVoltageMax = 70.0 ' High Voltage Max
        MiniXConstant.dblDefaultdblHighVoltage = 45.0 ' Default High Voltage kV
        MiniXConstant.dblCurrentMin = 10.0 ' Current Min
        MiniXConstant.dblCurrentMax = 143.0 ' Current Max
        MiniXConstant.dblDefaultCurrent = 15.0 ' Default Current
        MiniXConstant.dblWattageMax = 10.0 ' Wattage Max
    End Sub

    Public Sub ReadMiniXSetupDisplay(ByVal MxForm As frmMiniX, ByVal MiniXConstant As MiniX_Constant)
        Dim cstrVal As String = ""

        cstrVal = MxDblDispFormat(MiniXConstant.dblHighVoltageMin)
        MxForm.lblMIN(1).Text = cstrVal

        cstrVal = MxDblDispFormat(MiniXConstant.dblHighVoltageMax)
        MxForm.lblMAX(1).Text = cstrVal

        cstrVal = MxDblDispFormat(MiniXConstant.dblDefaultdblHighVoltage)
        MxForm.txtHv.Text = cstrVal

        cstrVal = MxDblDispFormat(MiniXConstant.dblCurrentMin)
        MxForm.lblMIN(2).Text = cstrVal

        cstrVal = MxDblDispFormat(MiniXConstant.dblCurrentMax)
        MxForm.lblMAX(2).Text = cstrVal

        cstrVal = MxDblDispFormat(MiniXConstant.dblDefaultCurrent)
        MxForm.txtCurrent.Text = cstrVal

    End Sub

    Public Function MxDblDispFormat(ByVal dblValue As Double) As String
        Dim strDisplay As String = ""
        MxDblDispFormat = ""
        'strDisplay = VB6.Format(dblValue, "0")
        strDisplay = (dblValue).ToString("0")
        MxDblDispFormat = strDisplay
    End Function
End Module
