'************************************************************************************************************************
' File: PMACSshore.vb
' Programmer: Ting Chan
' Date: September 8, 2004
'
' Description:
' This form is the shore station window for the PMACS client GUI of the MARS project.
' This form is the control and display form for shore station power supply.
' This form allows the user to view the shore voltage and current ouptut into the whole system.
' This form allows the user to view the status of the MV converters
' The user is allow to change the status of the power supply, voltage and current limits.
'
' Revision History:
' 04-06-2005 Added interface to server for changing SPS status, voltage and current limits
'            and ramping time constant by Ting Chan, UWEE
' 05-05-2005 Added error checking for voltage and current limit setting in 
'            ShoreSetLimitConfirm_Click() event by Ting Chan, UWEE
' 05-05-2005 Added error checking for ramping time constant in
'            SetShoreTCConfirm_Click() event by Ting Chan, UWEE
' 06-20-2005 Added login control for changing Status, Voltage limit, Current Limit 
'            and Ramping Time Constant by Ting Chan, UWEE
'
'************************************************************************************************************************
Option Strict Off
Option Explicit On
Friend Class PMACSshore
    Inherits System.Windows.Forms.Form
#Region "Windows Form Designer generated code "
    Public Sub New()
        MyBase.New()
        If m_vb6FormDefInstance Is Nothing Then
            If m_InitializingDefInstance Then
                m_vb6FormDefInstance = Me
            Else
                Try
                    'For the start-up form, the first instance created is the default instance.
                    If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
                        m_vb6FormDefInstance = Me
                    End If
                Catch
                End Try
            End If
        End If
        'This call is required by the Windows Form Designer.
        InitializeComponent()
        'This form is an MDI child.
        'This code simulates the VB6 
        ' functionality of automatically
        ' loading and showing an MDI
        ' child's parent.
        'Me.MdiParent = Project1.PMACSstartup.DefInstance.DefInstance
        Project1.PMACSstartup.DefInstance.DefInstance.Show()
        'The MDI form in the VB6 project had its
        'AutoShowChildren property set to True
        'To simulate the VB6 behavior, we need to
        'automatically Show the form whenever it
        'is loaded.  If you do not want this behavior
        'then delete the following line of code
        'UPGRADE_NOTE: Remove the next line of code to stop form from automatically showing. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup2018"'
        'Me.Show()
    End Sub
    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
        If Disposing Then
            If Not components Is Nothing Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(Disposing)
    End Sub
    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer
    Public ToolTip1 As System.Windows.Forms.ToolTip
    Public WithEvents SetShoreLimits As System.Windows.Forms.Button
    Public WithEvents TurnShoreOnOff As System.Windows.Forms.Button
    Public WithEvents ShoreSetLimitCancel As System.Windows.Forms.Button
    Public WithEvents ShoreSetLimitConfirm As System.Windows.Forms.Button
    Public WithEvents ShoreILimit As System.Windows.Forms.TextBox
    Public WithEvents ShoreVLimit As System.Windows.Forms.TextBox
    Public WithEvents Label4 As System.Windows.Forms.Label
    Public WithEvents Label3 As System.Windows.Forms.Label
    Public WithEvents Frame2 As System.Windows.Forms.GroupBox
    Public WithEvents ShoreTurnOff As System.Windows.Forms.RadioButton
    Public WithEvents ShoreTurnOn As System.Windows.Forms.RadioButton
    Public WithEvents Frame1 As System.Windows.Forms.GroupBox
    Public WithEvents ShoreI As System.Windows.Forms.TextBox
    Public WithEvents ShoreV As System.Windows.Forms.TextBox
    Public WithEvents ShoreStatus As System.Windows.Forms.Label
    Public WithEvents Label2 As System.Windows.Forms.Label
    Public WithEvents Label1 As System.Windows.Forms.Label
    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Friend WithEvents ShoreOnOffConfirm As System.Windows.Forms.Button
    Friend WithEvents ShoreOnOffCancel As System.Windows.Forms.Button
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents ShoreVEst As System.Windows.Forms.TextBox
    Friend WithEvents Label8 As System.Windows.Forms.Label
    Friend WithEvents ShoreIEst As System.Windows.Forms.TextBox
    Friend WithEvents Label9 As System.Windows.Forms.Label
    Friend WithEvents ShoreTimeConstant As System.Windows.Forms.TextBox
    Public WithEvents SetShoreTC As System.Windows.Forms.Button
    Public WithEvents ShoreTC As System.Windows.Forms.TextBox
    Public WithEvents Label12 As System.Windows.Forms.Label
    Public WithEvents SetShoreTCCancel As System.Windows.Forms.Button
    Public WithEvents SetShoreTCConfirm As System.Windows.Forms.Button
    Friend WithEvents Label10 As System.Windows.Forms.Label
    Public WithEvents Frame3 As System.Windows.Forms.GroupBox
    Public WithEvents DateTime As System.Windows.Forms.Label
    Friend WithEvents Label21 As System.Windows.Forms.Label
    Friend WithEvents Label11 As System.Windows.Forms.Label
    Friend WithEvents Label13 As System.Windows.Forms.Label
    Friend WithEvents Label14 As System.Windows.Forms.Label
    Friend WithEvents Label15 As System.Windows.Forms.Label
    Friend WithEvents ShoreSupplyManagement As System.Windows.Forms.Panel
    Friend WithEvents Label16 As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
        Me.SetShoreLimits = New System.Windows.Forms.Button
        Me.TurnShoreOnOff = New System.Windows.Forms.Button
        Me.Frame2 = New System.Windows.Forms.GroupBox
        Me.Label6 = New System.Windows.Forms.Label
        Me.Label5 = New System.Windows.Forms.Label
        Me.ShoreSetLimitCancel = New System.Windows.Forms.Button
        Me.ShoreSetLimitConfirm = New System.Windows.Forms.Button
        Me.ShoreILimit = New System.Windows.Forms.TextBox
        Me.ShoreVLimit = New System.Windows.Forms.TextBox
        Me.Label4 = New System.Windows.Forms.Label
        Me.Label3 = New System.Windows.Forms.Label
        Me.Frame1 = New System.Windows.Forms.GroupBox
        Me.ShoreOnOffCancel = New System.Windows.Forms.Button
        Me.ShoreOnOffConfirm = New System.Windows.Forms.Button
        Me.ShoreTurnOff = New System.Windows.Forms.RadioButton
        Me.ShoreTurnOn = New System.Windows.Forms.RadioButton
        Me.ShoreI = New System.Windows.Forms.TextBox
        Me.ShoreV = New System.Windows.Forms.TextBox
        Me.ShoreStatus = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label7 = New System.Windows.Forms.Label
        Me.ShoreVEst = New System.Windows.Forms.TextBox
        Me.Label8 = New System.Windows.Forms.Label
        Me.ShoreIEst = New System.Windows.Forms.TextBox
        Me.Label9 = New System.Windows.Forms.Label
        Me.ShoreTimeConstant = New System.Windows.Forms.TextBox
        Me.SetShoreTC = New System.Windows.Forms.Button
        Me.Frame3 = New System.Windows.Forms.GroupBox
        Me.Label10 = New System.Windows.Forms.Label
        Me.SetShoreTCCancel = New System.Windows.Forms.Button
        Me.SetShoreTCConfirm = New System.Windows.Forms.Button
        Me.ShoreTC = New System.Windows.Forms.TextBox
        Me.Label12 = New System.Windows.Forms.Label
        Me.DateTime = New System.Windows.Forms.Label
        Me.Label21 = New System.Windows.Forms.Label
        Me.Label11 = New System.Windows.Forms.Label
        Me.Label13 = New System.Windows.Forms.Label
        Me.Label14 = New System.Windows.Forms.Label
        Me.Label15 = New System.Windows.Forms.Label
        Me.ShoreSupplyManagement = New System.Windows.Forms.Panel
        Me.Label16 = New System.Windows.Forms.Label
        Me.Frame2.SuspendLayout()
        Me.Frame1.SuspendLayout()
        Me.Frame3.SuspendLayout()
        Me.ShoreSupplyManagement.SuspendLayout()
        Me.SuspendLayout()
        '
        'SetShoreLimits
        '
        Me.SetShoreLimits.BackColor = System.Drawing.SystemColors.Control
        Me.SetShoreLimits.Cursor = System.Windows.Forms.Cursors.Hand
        Me.SetShoreLimits.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.SetShoreLimits.ForeColor = System.Drawing.SystemColors.ControlText
        Me.SetShoreLimits.Location = New System.Drawing.Point(472, 120)
        Me.SetShoreLimits.Name = "SetShoreLimits"
        Me.SetShoreLimits.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.SetShoreLimits.Size = New System.Drawing.Size(297, 49)
        Me.SetShoreLimits.TabIndex = 17
        Me.SetShoreLimits.Text = "Set Shore Voltage and Current Limits"
        '
        'TurnShoreOnOff
        '
        Me.TurnShoreOnOff.BackColor = System.Drawing.SystemColors.Control
        Me.TurnShoreOnOff.Cursor = System.Windows.Forms.Cursors.Hand
        Me.TurnShoreOnOff.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.TurnShoreOnOff.ForeColor = System.Drawing.SystemColors.ControlText
        Me.TurnShoreOnOff.Location = New System.Drawing.Point(56, 120)
        Me.TurnShoreOnOff.Name = "TurnShoreOnOff"
        Me.TurnShoreOnOff.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.TurnShoreOnOff.Size = New System.Drawing.Size(297, 49)
        Me.TurnShoreOnOff.TabIndex = 16
        Me.TurnShoreOnOff.Text = "Turn On/Off Shore Power Supply"
        '
        'Frame2
        '
        Me.Frame2.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(255, Byte), CType(255, Byte))
        Me.Frame2.Controls.Add(Me.Label6)
        Me.Frame2.Controls.Add(Me.Label5)
        Me.Frame2.Controls.Add(Me.ShoreSetLimitCancel)
        Me.Frame2.Controls.Add(Me.ShoreSetLimitConfirm)
        Me.Frame2.Controls.Add(Me.ShoreILimit)
        Me.Frame2.Controls.Add(Me.ShoreVLimit)
        Me.Frame2.Controls.Add(Me.Label4)
        Me.Frame2.Controls.Add(Me.Label3)
        Me.Frame2.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Frame2.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame2.Location = New System.Drawing.Point(432, 192)
        Me.Frame2.Name = "Frame2"
        Me.Frame2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame2.Size = New System.Drawing.Size(376, 152)
        Me.Frame2.TabIndex = 9
        Me.Frame2.TabStop = False
        Me.Frame2.Text = "Voltage and Current Limits"
        Me.Frame2.Visible = False
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(336, 72)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(24, 24)
        Me.Label6.TabIndex = 17
        Me.Label6.Text = "A"
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(336, 32)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(24, 24)
        Me.Label5.TabIndex = 16
        Me.Label5.Text = "V"
        '
        'ShoreSetLimitCancel
        '
        Me.ShoreSetLimitCancel.BackColor = System.Drawing.SystemColors.Control
        Me.ShoreSetLimitCancel.Cursor = System.Windows.Forms.Cursors.Default
        Me.ShoreSetLimitCancel.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ShoreSetLimitCancel.ForeColor = System.Drawing.Color.Black
        Me.ShoreSetLimitCancel.Location = New System.Drawing.Point(240, 112)
        Me.ShoreSetLimitCancel.Name = "ShoreSetLimitCancel"
        Me.ShoreSetLimitCancel.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.ShoreSetLimitCancel.Size = New System.Drawing.Size(96, 24)
        Me.ShoreSetLimitCancel.TabIndex = 15
        Me.ShoreSetLimitCancel.Text = "Cancel"
        '
        'ShoreSetLimitConfirm
        '
        Me.ShoreSetLimitConfirm.BackColor = System.Drawing.SystemColors.Control
        Me.ShoreSetLimitConfirm.Cursor = System.Windows.Forms.Cursors.Default
        Me.ShoreSetLimitConfirm.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ShoreSetLimitConfirm.ForeColor = System.Drawing.Color.Black
        Me.ShoreSetLimitConfirm.Location = New System.Drawing.Point(48, 112)
        Me.ShoreSetLimitConfirm.Name = "ShoreSetLimitConfirm"
        Me.ShoreSetLimitConfirm.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.ShoreSetLimitConfirm.Size = New System.Drawing.Size(96, 24)
        Me.ShoreSetLimitConfirm.TabIndex = 14
        Me.ShoreSetLimitConfirm.Text = "Confirm"
        '
        'ShoreILimit
        '
        Me.ShoreILimit.AcceptsReturn = True
        Me.ShoreILimit.AutoSize = False
        Me.ShoreILimit.BackColor = System.Drawing.SystemColors.Window
        Me.ShoreILimit.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.ShoreILimit.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ShoreILimit.ForeColor = System.Drawing.SystemColors.WindowText
        Me.ShoreILimit.Location = New System.Drawing.Point(224, 64)
        Me.ShoreILimit.MaxLength = 0
        Me.ShoreILimit.Name = "ShoreILimit"
        Me.ShoreILimit.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.ShoreILimit.Size = New System.Drawing.Size(105, 32)
        Me.ShoreILimit.TabIndex = 13
        Me.ShoreILimit.Text = ""
        Me.ShoreILimit.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'ShoreVLimit
        '
        Me.ShoreVLimit.AcceptsReturn = True
        Me.ShoreVLimit.AutoSize = False
        Me.ShoreVLimit.BackColor = System.Drawing.SystemColors.Window
        Me.ShoreVLimit.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.ShoreVLimit.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ShoreVLimit.ForeColor = System.Drawing.SystemColors.WindowText
        Me.ShoreVLimit.Location = New System.Drawing.Point(224, 24)
        Me.ShoreVLimit.MaxLength = 0
        Me.ShoreVLimit.Name = "ShoreVLimit"
        Me.ShoreVLimit.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.ShoreVLimit.Size = New System.Drawing.Size(105, 32)
        Me.ShoreVLimit.TabIndex = 11
        Me.ShoreVLimit.Text = ""
        Me.ShoreVLimit.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label4
        '
        Me.Label4.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(255, Byte), CType(255, Byte))
        Me.Label4.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label4.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label4.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label4.Location = New System.Drawing.Point(48, 72)
        Me.Label4.Name = "Label4"
        Me.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label4.Size = New System.Drawing.Size(129, 25)
        Me.Label4.TabIndex = 12
        Me.Label4.Text = "Current Limit"
        '
        'Label3
        '
        Me.Label3.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(255, Byte), CType(255, Byte))
        Me.Label3.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label3.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label3.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label3.Location = New System.Drawing.Point(48, 32)
        Me.Label3.Name = "Label3"
        Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label3.Size = New System.Drawing.Size(129, 25)
        Me.Label3.TabIndex = 10
        Me.Label3.Text = "Voltage Limit"
        '
        'Frame1
        '
        Me.Frame1.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(255, Byte), CType(255, Byte))
        Me.Frame1.Controls.Add(Me.ShoreOnOffCancel)
        Me.Frame1.Controls.Add(Me.ShoreOnOffConfirm)
        Me.Frame1.Controls.Add(Me.ShoreTurnOff)
        Me.Frame1.Controls.Add(Me.ShoreTurnOn)
        Me.Frame1.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Frame1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame1.Location = New System.Drawing.Point(16, 192)
        Me.Frame1.Name = "Frame1"
        Me.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame1.Size = New System.Drawing.Size(376, 152)
        Me.Frame1.TabIndex = 5
        Me.Frame1.TabStop = False
        Me.Frame1.Text = "Shore Power Supply ON/OFF Control"
        Me.Frame1.Visible = False
        '
        'ShoreOnOffCancel
        '
        Me.ShoreOnOffCancel.BackColor = System.Drawing.SystemColors.Control
        Me.ShoreOnOffCancel.Location = New System.Drawing.Point(240, 112)
        Me.ShoreOnOffCancel.Name = "ShoreOnOffCancel"
        Me.ShoreOnOffCancel.Size = New System.Drawing.Size(96, 24)
        Me.ShoreOnOffCancel.TabIndex = 9
        Me.ShoreOnOffCancel.Text = "Cancel"
        '
        'ShoreOnOffConfirm
        '
        Me.ShoreOnOffConfirm.BackColor = System.Drawing.SystemColors.Control
        Me.ShoreOnOffConfirm.Location = New System.Drawing.Point(48, 112)
        Me.ShoreOnOffConfirm.Name = "ShoreOnOffConfirm"
        Me.ShoreOnOffConfirm.Size = New System.Drawing.Size(96, 24)
        Me.ShoreOnOffConfirm.TabIndex = 8
        Me.ShoreOnOffConfirm.Text = "Confirm"
        '
        'ShoreTurnOff
        '
        Me.ShoreTurnOff.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(255, Byte), CType(255, Byte))
        Me.ShoreTurnOff.Cursor = System.Windows.Forms.Cursors.Default
        Me.ShoreTurnOff.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ShoreTurnOff.ForeColor = System.Drawing.SystemColors.ControlText
        Me.ShoreTurnOff.Location = New System.Drawing.Point(216, 32)
        Me.ShoreTurnOff.Name = "ShoreTurnOff"
        Me.ShoreTurnOff.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.ShoreTurnOff.Size = New System.Drawing.Size(144, 57)
        Me.ShoreTurnOff.TabIndex = 7
        Me.ShoreTurnOff.TabStop = True
        Me.ShoreTurnOff.Text = "Turn Off Shore Power Supply"
        '
        'ShoreTurnOn
        '
        Me.ShoreTurnOn.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(255, Byte), CType(255, Byte))
        Me.ShoreTurnOn.Cursor = System.Windows.Forms.Cursors.Default
        Me.ShoreTurnOn.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ShoreTurnOn.ForeColor = System.Drawing.SystemColors.ControlText
        Me.ShoreTurnOn.Location = New System.Drawing.Point(24, 32)
        Me.ShoreTurnOn.Name = "ShoreTurnOn"
        Me.ShoreTurnOn.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.ShoreTurnOn.Size = New System.Drawing.Size(144, 57)
        Me.ShoreTurnOn.TabIndex = 6
        Me.ShoreTurnOn.TabStop = True
        Me.ShoreTurnOn.Text = "Turn On Shore Power Supply"
        '
        'ShoreI
        '
        Me.ShoreI.AcceptsReturn = True
        Me.ShoreI.AutoSize = False
        Me.ShoreI.BackColor = System.Drawing.SystemColors.Window
        Me.ShoreI.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.ShoreI.Font = New System.Drawing.Font("Arial", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ShoreI.ForeColor = System.Drawing.SystemColors.WindowText
        Me.ShoreI.Location = New System.Drawing.Point(920, 168)
        Me.ShoreI.MaxLength = 0
        Me.ShoreI.Name = "ShoreI"
        Me.ShoreI.ReadOnly = True
        Me.ShoreI.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.ShoreI.Size = New System.Drawing.Size(120, 29)
        Me.ShoreI.TabIndex = 3
        Me.ShoreI.Text = ""
        Me.ShoreI.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'ShoreV
        '
        Me.ShoreV.AcceptsReturn = True
        Me.ShoreV.AutoSize = False
        Me.ShoreV.BackColor = System.Drawing.SystemColors.Window
        Me.ShoreV.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.ShoreV.Font = New System.Drawing.Font("Arial", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ShoreV.ForeColor = System.Drawing.Color.Black
        Me.ShoreV.Location = New System.Drawing.Point(512, 168)
        Me.ShoreV.MaxLength = 0
        Me.ShoreV.Name = "ShoreV"
        Me.ShoreV.ReadOnly = True
        Me.ShoreV.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.ShoreV.Size = New System.Drawing.Size(113, 29)
        Me.ShoreV.TabIndex = 2
        Me.ShoreV.Text = ""
        Me.ShoreV.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'ShoreStatus
        '
        Me.ShoreStatus.BackColor = System.Drawing.Color.Transparent
        Me.ShoreStatus.Cursor = System.Windows.Forms.Cursors.Default
        Me.ShoreStatus.Font = New System.Drawing.Font("Arial", 24.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ShoreStatus.ForeColor = System.Drawing.Color.Red
        Me.ShoreStatus.Location = New System.Drawing.Point(424, 88)
        Me.ShoreStatus.Name = "ShoreStatus"
        Me.ShoreStatus.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.ShoreStatus.Size = New System.Drawing.Size(504, 56)
        Me.ShoreStatus.TabIndex = 8
        Me.ShoreStatus.Text = "Shore Power Supply Status"
        Me.ShoreStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'Label2
        '
        Me.Label2.BackColor = System.Drawing.Color.Transparent
        Me.Label2.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label2.Font = New System.Drawing.Font("Arial", 13.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label2.ForeColor = System.Drawing.Color.Yellow
        Me.Label2.Location = New System.Drawing.Point(720, 168)
        Me.Label2.Name = "Label2"
        Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label2.Size = New System.Drawing.Size(184, 24)
        Me.Label2.TabIndex = 1
        Me.Label2.Text = "Current (Measured)"
        '
        'Label1
        '
        Me.Label1.BackColor = System.Drawing.Color.Transparent
        Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label1.Font = New System.Drawing.Font("Arial", 13.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.ForeColor = System.Drawing.Color.Yellow
        Me.Label1.Location = New System.Drawing.Point(312, 168)
        Me.Label1.Name = "Label1"
        Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label1.Size = New System.Drawing.Size(184, 24)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Voltage (Measured)"
        '
        'Label7
        '
        Me.Label7.Font = New System.Drawing.Font("Arial", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label7.ForeColor = System.Drawing.Color.Yellow
        Me.Label7.Location = New System.Drawing.Point(312, 216)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(192, 24)
        Me.Label7.TabIndex = 18
        Me.Label7.Text = "Voltage (Estimated)"
        '
        'ShoreVEst
        '
        Me.ShoreVEst.BackColor = System.Drawing.Color.White
        Me.ShoreVEst.Font = New System.Drawing.Font("Arial", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ShoreVEst.Location = New System.Drawing.Point(512, 216)
        Me.ShoreVEst.Name = "ShoreVEst"
        Me.ShoreVEst.ReadOnly = True
        Me.ShoreVEst.Size = New System.Drawing.Size(112, 29)
        Me.ShoreVEst.TabIndex = 19
        Me.ShoreVEst.Text = ""
        Me.ShoreVEst.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label8
        '
        Me.Label8.Font = New System.Drawing.Font("Arial", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label8.ForeColor = System.Drawing.Color.Yellow
        Me.Label8.Location = New System.Drawing.Point(720, 216)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(192, 24)
        Me.Label8.TabIndex = 20
        Me.Label8.Text = "Current (Estimated)"
        '
        'ShoreIEst
        '
        Me.ShoreIEst.BackColor = System.Drawing.Color.White
        Me.ShoreIEst.Font = New System.Drawing.Font("Arial", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ShoreIEst.Location = New System.Drawing.Point(920, 216)
        Me.ShoreIEst.Name = "ShoreIEst"
        Me.ShoreIEst.ReadOnly = True
        Me.ShoreIEst.Size = New System.Drawing.Size(120, 29)
        Me.ShoreIEst.TabIndex = 21
        Me.ShoreIEst.Text = ""
        Me.ShoreIEst.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label9
        '
        Me.Label9.Font = New System.Drawing.Font("Arial", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label9.ForeColor = System.Drawing.Color.Yellow
        Me.Label9.Location = New System.Drawing.Point(312, 272)
        Me.Label9.Name = "Label9"
        Me.Label9.Size = New System.Drawing.Size(504, 24)
        Me.Label9.TabIndex = 22
        Me.Label9.Text = "Shore Power Supply Voltage Ramping Time Constant"
        '
        'ShoreTimeConstant
        '
        Me.ShoreTimeConstant.BackColor = System.Drawing.Color.White
        Me.ShoreTimeConstant.Font = New System.Drawing.Font("Arial", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ShoreTimeConstant.Location = New System.Drawing.Point(824, 272)
        Me.ShoreTimeConstant.Name = "ShoreTimeConstant"
        Me.ShoreTimeConstant.ReadOnly = True
        Me.ShoreTimeConstant.Size = New System.Drawing.Size(216, 29)
        Me.ShoreTimeConstant.TabIndex = 23
        Me.ShoreTimeConstant.Text = ""
        Me.ShoreTimeConstant.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'SetShoreTC
        '
        Me.SetShoreTC.BackColor = System.Drawing.SystemColors.Control
        Me.SetShoreTC.Cursor = System.Windows.Forms.Cursors.Hand
        Me.SetShoreTC.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.SetShoreTC.ForeColor = System.Drawing.SystemColors.ControlText
        Me.SetShoreTC.Location = New System.Drawing.Point(888, 120)
        Me.SetShoreTC.Name = "SetShoreTC"
        Me.SetShoreTC.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.SetShoreTC.Size = New System.Drawing.Size(297, 49)
        Me.SetShoreTC.TabIndex = 24
        Me.SetShoreTC.Text = "Set Shore Power Supply Voltage Ramping Time Constant "
        '
        'Frame3
        '
        Me.Frame3.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(255, Byte), CType(255, Byte))
        Me.Frame3.Controls.Add(Me.Label10)
        Me.Frame3.Controls.Add(Me.SetShoreTCCancel)
        Me.Frame3.Controls.Add(Me.SetShoreTCConfirm)
        Me.Frame3.Controls.Add(Me.ShoreTC)
        Me.Frame3.Controls.Add(Me.Label12)
        Me.Frame3.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Frame3.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Frame3.Location = New System.Drawing.Point(848, 192)
        Me.Frame3.Name = "Frame3"
        Me.Frame3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Frame3.Size = New System.Drawing.Size(376, 152)
        Me.Frame3.TabIndex = 25
        Me.Frame3.TabStop = False
        Me.Frame3.Text = "Voltage Ramping Time Constant"
        Me.Frame3.Visible = False
        '
        'Label10
        '
        Me.Label10.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label10.Location = New System.Drawing.Point(256, 56)
        Me.Label10.Name = "Label10"
        Me.Label10.Size = New System.Drawing.Size(112, 24)
        Me.Label10.TabIndex = 17
        Me.Label10.Text = "Volts/Second"
        '
        'SetShoreTCCancel
        '
        Me.SetShoreTCCancel.BackColor = System.Drawing.SystemColors.Control
        Me.SetShoreTCCancel.Cursor = System.Windows.Forms.Cursors.Default
        Me.SetShoreTCCancel.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.SetShoreTCCancel.ForeColor = System.Drawing.SystemColors.ControlText
        Me.SetShoreTCCancel.Location = New System.Drawing.Point(264, 112)
        Me.SetShoreTCCancel.Name = "SetShoreTCCancel"
        Me.SetShoreTCCancel.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.SetShoreTCCancel.Size = New System.Drawing.Size(96, 24)
        Me.SetShoreTCCancel.TabIndex = 15
        Me.SetShoreTCCancel.Text = "Cancel"
        '
        'SetShoreTCConfirm
        '
        Me.SetShoreTCConfirm.BackColor = System.Drawing.SystemColors.Control
        Me.SetShoreTCConfirm.Cursor = System.Windows.Forms.Cursors.Default
        Me.SetShoreTCConfirm.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.SetShoreTCConfirm.ForeColor = System.Drawing.SystemColors.ControlText
        Me.SetShoreTCConfirm.Location = New System.Drawing.Point(56, 112)
        Me.SetShoreTCConfirm.Name = "SetShoreTCConfirm"
        Me.SetShoreTCConfirm.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.SetShoreTCConfirm.Size = New System.Drawing.Size(96, 24)
        Me.SetShoreTCConfirm.TabIndex = 14
        Me.SetShoreTCConfirm.Text = "Confirm"
        '
        'ShoreTC
        '
        Me.ShoreTC.AcceptsReturn = True
        Me.ShoreTC.AutoSize = False
        Me.ShoreTC.BackColor = System.Drawing.SystemColors.Window
        Me.ShoreTC.Cursor = System.Windows.Forms.Cursors.IBeam
        Me.ShoreTC.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.ShoreTC.ForeColor = System.Drawing.SystemColors.WindowText
        Me.ShoreTC.Location = New System.Drawing.Point(144, 48)
        Me.ShoreTC.MaxLength = 0
        Me.ShoreTC.Name = "ShoreTC"
        Me.ShoreTC.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.ShoreTC.Size = New System.Drawing.Size(105, 32)
        Me.ShoreTC.TabIndex = 13
        Me.ShoreTC.Text = ""
        Me.ShoreTC.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
        '
        'Label12
        '
        Me.Label12.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(255, Byte), CType(255, Byte))
        Me.Label12.Cursor = System.Windows.Forms.Cursors.Default
        Me.Label12.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label12.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label12.Location = New System.Drawing.Point(16, 56)
        Me.Label12.Name = "Label12"
        Me.Label12.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Label12.Size = New System.Drawing.Size(129, 25)
        Me.Label12.TabIndex = 12
        Me.Label12.Text = "Time Constant"
        '
        'DateTime
        '
        Me.DateTime.BackColor = System.Drawing.Color.Transparent
        Me.DateTime.Cursor = System.Windows.Forms.Cursors.Default
        Me.DateTime.Font = New System.Drawing.Font("Arial", 20.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.DateTime.ForeColor = System.Drawing.Color.Yellow
        Me.DateTime.Location = New System.Drawing.Point(792, 16)
        Me.DateTime.Name = "DateTime"
        Me.DateTime.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.DateTime.Size = New System.Drawing.Size(464, 33)
        Me.DateTime.TabIndex = 599
        Me.DateTime.Text = "Date"
        Me.DateTime.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        '
        'Label21
        '
        Me.Label21.BackColor = System.Drawing.Color.FromArgb(CType(224, Byte), CType(224, Byte), CType(224, Byte))
        Me.Label21.Location = New System.Drawing.Point(784, 8)
        Me.Label21.Name = "Label21"
        Me.Label21.Size = New System.Drawing.Size(480, 48)
        Me.Label21.TabIndex = 600
        '
        'Label11
        '
        Me.Label11.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(255, Byte), CType(255, Byte))
        Me.Label11.Location = New System.Drawing.Point(416, 80)
        Me.Label11.Name = "Label11"
        Me.Label11.Size = New System.Drawing.Size(520, 72)
        Me.Label11.TabIndex = 601
        '
        'Label13
        '
        Me.Label13.BackColor = System.Drawing.Color.FromArgb(CType(224, Byte), CType(224, Byte), CType(224, Byte))
        Me.Label13.Location = New System.Drawing.Point(48, 8)
        Me.Label13.Name = "Label13"
        Me.Label13.Size = New System.Drawing.Size(712, 48)
        Me.Label13.TabIndex = 602
        Me.Label13.Visible = False
        '
        'Label14
        '
        Me.Label14.Font = New System.Drawing.Font("Arial", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label14.ForeColor = System.Drawing.Color.Red
        Me.Label14.Location = New System.Drawing.Point(56, 16)
        Me.Label14.Name = "Label14"
        Me.Label14.Size = New System.Drawing.Size(696, 32)
        Me.Label14.TabIndex = 603
        Me.Label14.Text = "Shore Power Supply Control is Disabled for Remote Clients"
        Me.Label14.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        Me.Label14.Visible = False
        '
        'Label15
        '
        Me.Label15.Font = New System.Drawing.Font("Arial", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label15.ForeColor = System.Drawing.Color.Yellow
        Me.Label15.Location = New System.Drawing.Point(424, 32)
        Me.Label15.Name = "Label15"
        Me.Label15.Size = New System.Drawing.Size(392, 48)
        Me.Label15.TabIndex = 604
        Me.Label15.Text = "Manage Shore Station Power Supply"
        Me.Label15.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'ShoreSupplyManagement
        '
        Me.ShoreSupplyManagement.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.ShoreSupplyManagement.Controls.Add(Me.Frame1)
        Me.ShoreSupplyManagement.Controls.Add(Me.TurnShoreOnOff)
        Me.ShoreSupplyManagement.Controls.Add(Me.SetShoreLimits)
        Me.ShoreSupplyManagement.Controls.Add(Me.SetShoreTC)
        Me.ShoreSupplyManagement.Controls.Add(Me.Frame2)
        Me.ShoreSupplyManagement.Controls.Add(Me.Frame3)
        Me.ShoreSupplyManagement.Controls.Add(Me.Label15)
        Me.ShoreSupplyManagement.Controls.Add(Me.Label16)
        Me.ShoreSupplyManagement.Location = New System.Drawing.Point(24, 312)
        Me.ShoreSupplyManagement.Name = "ShoreSupplyManagement"
        Me.ShoreSupplyManagement.Size = New System.Drawing.Size(1240, 368)
        Me.ShoreSupplyManagement.TabIndex = 605
        '
        'Label16
        '
        Me.Label16.BackColor = System.Drawing.Color.Silver
        Me.Label16.Location = New System.Drawing.Point(416, 24)
        Me.Label16.Name = "Label16"
        Me.Label16.Size = New System.Drawing.Size(408, 64)
        Me.Label16.TabIndex = 605
        '
        'PMACSshore
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackColor = System.Drawing.Color.Black
        Me.ClientSize = New System.Drawing.Size(1272, 986)
        Me.Controls.Add(Me.ShoreSupplyManagement)
        Me.Controls.Add(Me.Label14)
        Me.Controls.Add(Me.DateTime)
        Me.Controls.Add(Me.Label21)
        Me.Controls.Add(Me.ShoreTimeConstant)
        Me.Controls.Add(Me.ShoreIEst)
        Me.Controls.Add(Me.ShoreVEst)
        Me.Controls.Add(Me.ShoreI)
        Me.Controls.Add(Me.ShoreV)
        Me.Controls.Add(Me.Label9)
        Me.Controls.Add(Me.Label8)
        Me.Controls.Add(Me.Label7)
        Me.Controls.Add(Me.ShoreStatus)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.Label11)
        Me.Controls.Add(Me.Label13)
        Me.Cursor = System.Windows.Forms.Cursors.Default
        Me.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Location = New System.Drawing.Point(4, 23)
        Me.Name = "PMACSshore"
        Me.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultBounds
        Me.Text = "PMACS Shore Station"
        Me.Frame2.ResumeLayout(False)
        Me.Frame1.ResumeLayout(False)
        Me.Frame3.ResumeLayout(False)
        Me.ShoreSupplyManagement.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub
#End Region
#Region "Upgrade Support "
    Private Shared m_vb6FormDefInstance As PMACSshore
    Private Shared m_InitializingDefInstance As Boolean
    Public Shared Property DefInstance() As PMACSshore
        Get
            If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
                m_InitializingDefInstance = True
                m_vb6FormDefInstance = New PMACSshore
                m_InitializingDefInstance = False
            End If
            DefInstance = m_vb6FormDefInstance
        End Get
        Set(ByVal Value As PMACSshore)
            m_vb6FormDefInstance = Value
        End Set
    End Property
#End Region

#Region "Load PMACSshore form"
    '*******************************************************************************
    'Load the shore station form and initialize the control and display on the form
    '*******************************************************************************
    Private Sub PMACSshore_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim CRLF As Object
        Dim A As String
        Dim Y As Short
        Dim data As String

        If Shore.ShoreState = 1 Then
            ShoreStatus.ForeColor = System.Drawing.Color.YellowGreen
            ShoreStatus.Text = "Shore Power Supply is ON"
        Else
            ShoreStatus.ForeColor = System.Drawing.Color.Red
            ShoreStatus.Text = "Shore Power Supply is OFF"
        End If
        
        If Not (LoginType = 1) Then
            ShoreSupplyManagement.Visible = False
            ShoreSupplyManagement.Enabled = False
            Label13.Visible = True
            Label14.Visible = True
        End If
    End Sub
#End Region
    
#Region "Click Shore Station ON/OFF command button"
    '*******************************************************************
    'User clicks the SPS ON/OFF button, display the SPS status check box
    'frame1.
    '*******************************************************************
    Private Sub TurnShoreOnOff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TurnShoreOnOff.Click
        'Disable Timer1
        'PMACSstartup.DefInstance.Timer1.Enabled = False

        activeFlag = True
        If Shore.ShoreState = 1 Then
            ShoreTurnOn.Checked = True
        Else
            ShoreTurnOff.Checked = True
        End If
        Frame1.Visible = True
        Frame1.Enabled = True
    End Sub
#End Region
    
#Region "Click Set Shore Station Voltage ramping time constant command button"
    '******************************************************************
    'User wants to change the voltage ramping time constant,
    'display the frame3.
    '******************************************************************
    Private Sub SetShoreTC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SetShoreTC.Click
        activeFlag = True
        Frame3.Visible = True
        Frame3.Enabled = True
    End Sub
#End Region

#Region "Click Set voltage and current limit command button"
    '******************************************************************
    'User wants to change the voltage and current limits,
    'display the frame2.
    '******************************************************************
    Private Sub SetShoreLimits_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SetShoreLimits.Click
        'Disable Timer1
        'PMACSstartup.DefInstance.Timer1.Enabled = False

        Frame2.Visible = True
        Frame2.Enabled = True
    End Sub
#End Region
    
#Region "Confirm Shore Status ON/OFF"
    '********************************************************************
    'User confirm the status change for Shore Power Supply.
    'Send the information to the server and update the display.
    '********************************************************************
    Private Sub ShoreOnOffConfirm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShoreOnOffConfirm.Click
        Dim mstrName As Object
        Dim response As Short
        Dim response2 As Short
        Dim ONOFFresult As String
        Dim ws As New edu.washington.apl.pmacs.load_service  'work variable.

        If Not GotShoreData Then
            MsgBox("Cannot commuicate with Server at this moment. Try again later.")
            Exit Sub
        End If

        If ShoreTurnOn.Checked = True And Shore.ShoreState = 0 Then
            response = MsgBox("Turn Shore Power Supply On?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Confirm Operation" & mstrName)

            If response = MsgBoxResult.Yes Then
                'MsgBox("Please set the voltage and current limits!")
                Shore.ShoreState = 1
                Frame1.Visible = False
                Frame1.Enabled = False
                Frame2.Visible = True
                Frame2.Enabled = True

                'Set the cursor to be a hourglass
                Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
                ONOFFresult = ws.setSPSState(Shore.ShoreState)
                If ONOFFresult = "ok" Then
                    ShoreStatus.ForeColor = System.Drawing.Color.YellowGreen
                    ShoreStatus.Text = "Shore Power Supply is ON"
                Else
                    MsgBox("Server is Busy at this moment. Try turning on the Shore Power Supply at another time.")
                End If
                'Set the cursor to an arrow
                Cursor.Current = System.Windows.Forms.Cursors.Default
            Else
                'MsgBox("Shore Power Supply remains off!")
                Frame1.Visible = False
                Frame1.Enabled = False
                'Enable Timer1
                'PMACSstartup.DefInstance.Timer1.Enabled = True
            End If
        ElseIf ShoreTurnOn.Checked = True And Shore.ShoreState = 1 Then
            response = MsgBox("Shore Power Supply remains on?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Confirm Operation" & mstrName)
            If response = MsgBoxResult.Yes Then
                response2 = MsgBox("Reset voltage and current limits?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Confirm Operation" & mstrName)
                If response2 = MsgBoxResult.Yes Then
                    Shore.ShoreState = 1
                    Frame1.Visible = False
                    Frame1.Enabled = False
                    Frame2.Visible = True
                    Frame2.Enabled = True
                    ShoreStatus.ForeColor = System.Drawing.Color.YellowGreen
                    ShoreStatus.Text = "Shore Power Supply is ON"
                Else
                    'MsgBox("Voltage and current limits not reset!")
                    Shore.ShoreState = 1
                    Frame1.Visible = False
                    Frame1.Enabled = False
                    ShoreStatus.ForeColor = System.Drawing.Color.YellowGreen
                    ShoreStatus.Text = "Shore Power Supply is ON"
                    'Enable Timer1
                    'PMACSstartup.DefInstance.Timer1.Enabled = True
                End If
            End If
        ElseIf ShoreTurnOff.Checked = True And Shore.ShoreState = 1 Then
            response = MsgBox("Turn Shore Power Supply Off?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Confirm Operation" & mstrName)
            If response = MsgBoxResult.Yes Then

                Frame1.Visible = False
                Frame1.Enabled = False
                Shore.ShoreState = 0

                'Set the cursor to be a hourglass
                Cursor.Current = System.Windows.Forms.Cursors.WaitCursor

                ONOFFresult = ws.setSPSState(Shore.ShoreState)
                If ONOFFresult = "ok" Then
                    ShoreStatus.ForeColor = System.Drawing.Color.Red
                    ShoreStatus.Text = "Shore Power Supply is OFF"
                Else
                    MsgBox("Server is Busy at this moment. Try turning off the Shore Power Supply at another time.")
                End If

                'Set the cursor to an arrow
                Cursor.Current = System.Windows.Forms.Cursors.Default
                'Enable Timer1
                'PMACSstartup.DefInstance.Timer1.Enabled = True
            End If
        ElseIf ShoreTurnOff.Checked = True And Shore.ShoreState = 0 Then
            response = MsgBox("Shore Power Supply remains off?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Confirm Operation" & mstrName)
            If response = MsgBoxResult.Yes Then
                'MsgBox("Shore power Supply remains off!")
                Frame1.Visible = False
                Frame1.Enabled = False
                Shore.ShoreState = 0
                'Enable Timer1
                'PMACSstartup.DefInstance.Timer1.Enabled = True
            End If
        End If
        activeFlag = False
    End Sub
#End Region

#Region "Cancel setting shore ON/OFF status"
    '*******************************************************
    'user wants to cancel turning the SPS ON/OFF
    '*******************************************************
    Private Sub ShoreOnOffCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShoreOnOffCancel.Click
        Dim mstrName As Object
        Dim response As Short
        
        Frame1.Visible = False
        Frame1.Enabled = False
        activeFlag = False

    End Sub
#End Region
    
#Region "Confirm Shore Power Supply Voltage and Current limit settings"
    '********************************************************************
    'User confirm the change of Shore Power Supply Voltage and Current Limtis
    'Send the information to the server and update the display.
    '********************************************************************
    Private Sub ShoreSetLimitConfirm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShoreSetLimitConfirm.Click
        Dim myPrompt As String
        Dim response As Short
        Dim ws As New edu.washington.apl.pmacs.load_service  'work variable.
        Dim myErrorString As String
        Dim myString As String
        Dim SetVresult As String
        Dim SetIresult As String

        If Not GotShoreData Then
            MsgBox("Cannot commuicate with Server at this moment. Try again later.")
            Exit Sub
        End If

        response = MsgBox("Set voltage and current limits?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Confirm Operation")
        If response = MsgBoxResult.Yes Then
            'check to see if the inputs are numbers
            If IsNumeric(ShoreVLimit.Text) And IsNumeric(ShoreILimit.Text) Then
                Try
                    Shore.ShoreVoltageLimit = CDbl(ShoreVLimit.Text)
                    Shore.ShoreCurrentLimit = CDbl(ShoreILimit.Text)
                Catch ex As Exception
                    myPrompt = "Invalid Limits" + vbCrLf + vbCrLf
                    myPrompt = myPrompt + "Exact text of exception error information is as follows:" + vbCrLf
                    myPrompt = myPrompt + ex.ToString() + vbCrLf
                    Call ShowMessage(myPrompt)
                End Try

                'check if the input limits are within range
                If Shore.ShoreVoltageLimit <= 0 And Shore.ShoreVoltageLimit >= -10000 Then
                    If Shore.ShoreCurrentLimit >= 0 And Shore.ShoreCurrentLimit <= 1 Then
                        'Set the cursor to be a hourglass
                        Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
                        'send request to server to change voltage and current limits
                        'the read in current limit is in A, need to convert to mA
                        SetVresult = ws.setSPSVoltage(Shore.ShoreVoltageLimit)
                        SetIresult = ws.setSPSCurrent(Shore.ShoreCurrentLimit * 1000)

                        'confirm if limits have been setted
                        If SetVresult = "ok" And SetIresult = "ok" Then
                            'MsgBox("Voltage and current limits have been set!")
                        Else
                            MsgBox("Server is Busy at this moment. Try setting the limits at another time.")
                        End If
                        Frame2.Visible = False
                        Frame2.Enabled = False
                        'Set the cursor back to an arrow
                        Cursor.Current = System.Windows.Forms.Cursors.Arrow
                        activeFlag = False
                    Else
                        'current limit is out of range
                        myErrorString = "Inappropriate Current Limit!" + vbCrLf
                        myErrorString = myErrorString + "Please enter a Current Limit between 0 to 1."
                        MsgBox(myErrorString, MsgBoxStyle.Exclamation, "Invalid Current Limit")
                    End If
                Else
                    'voltage limit is out of range
                    myErrorString = "Inappropriate Voltage Limit!" + vbCrLf
                    myErrorString = myErrorString + "Please enter a Voltage Limit between -10000V and 0V."
                    MsgBox(myErrorString, MsgBoxStyle.Exclamation, "Invalid Voltage Limit")
                End If
            Else
                MsgBox("Please enter an appropriate voltage and current limit!", MsgBoxStyle.Exclamation, "Error")
            End If
        Else
            'operator cancels the change
            Frame2.Enabled = False
            Frame2.Visible = False
            activeFlag = False
        End If
    End Sub
#End Region

#Region "Cancel changing Shore Power Supply voltage and current limits"
    '*******************************************************
    'user wants to cancel changing the limits
    '*******************************************************
    Private Sub ShoreSetLimitCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShoreSetLimitCancel.Click
        Dim mstrName As Object
        Dim response As Short

        Frame2.Visible = False
        Frame2.Enabled = False
        activeFlag = False
    End Sub
#End Region

#Region "Confirm change of Shore Power Supply voltage ramping time constant"
    '********************************************************************
    'User confirm the change of Shore Power Supply Voltage and Current Limtis
    'Send the information to the server and update the display.
    '********************************************************************
    Private Sub SetShoreTCConfirm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SetShoreTCConfirm.Click
        Dim mstrName As Object
        Dim response As Short
        Dim myErrorString As String
        Dim ws As New edu.washington.apl.pmacs.load_service  'work variable.
        Dim myString As String
        Dim result As String

        If Not GotShoreData Then
            MsgBox("Cannot commuicate with Server at this moment. Try again later.")
            Exit Sub
        End If

        'confirm with the user that the ramping constant is to be changed
        response = MsgBox("Set Shore Power Supply Voltage Ramping Time Constant?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Confirm Operation" & mstrName)
        If response = MsgBoxResult.Yes Then
            'check to make sure the input is a number
            If IsNumeric(ShoreTC.Text) Then
                Shore.ShoreTc = CDbl(ShoreTC.Text)
                If Shore.ShoreTc > 0 Then
                    'Set the cursor to be a hourglass
                    Cursor.Current = System.Windows.Forms.Cursors.WaitCursor

                    'call the server to change the ramping time constant
                    result = ws.setSPSTc(Shore.ShoreTc)

                    'check to see if request is accepted
                    If result = "ok" Then
                        'MsgBox("Voltage ramping time constant have been set!")
                    Else
                        MsgBox("Server is Busy at this moment. Try setting the time constant at another time.")
                    End If
                    Frame3.Visible = False
                    Frame3.Enabled = False
                    'Set the cursor back to an arrow
                    Cursor.Current = System.Windows.Forms.Cursors.Arrow
                Else
                    'invalid number for ramping time constant, prompts the user for a valid number
                    myErrorString = "Inappropriate Voltage Ramping Time Constant!" + vbCrLf
                    myErrorString = myErrorString + "Please enter a positive Ramping Time Constant."
                    MsgBox(myErrorString, MsgBoxStyle.Exclamation, "Invalid Time Constant" & mstrName)
                End If
            Else
                'invalid number for ramping time constant, prompts the user for a valid number
                MsgBox("Please enter an appropriate numerical value for the voltage ramping time constant!", MsgBoxStyle.Exclamation, "Error" & mstrName)
            End If
        Else
            'user cancels the change
            'MsgBox("Voltage Ramping Time Constant unchanged!")
            Frame3.Enabled = False
            Frame3.Visible = False
        End If

        activeFlag = False
    End Sub
#End Region
    
#Region "Cancel changing Shore Power Supply voltage ramping time constant"
    '****************************************************************
    'user wants to cancel changing the voltage ramping time constant
    '****************************************************************
    Private Sub SetShoreTCCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SetShoreTCCancel.Click
        Dim mstrName As Object
        Dim response As Short
        
        Frame3.Visible = False
        Frame3.Enabled = False
        activeFlag = False
    End Sub
#End Region

End Class