Public Class frmScriptingReference
    Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
        Me.Close()
    End Sub

    Private Sub btnPluginSDK_Click(sender As Object, e As EventArgs) Handles btnPluginSDK.Click
        '' Add reference to PluginSDK to the Current ScriptingReference text box
        AddReferenceToTextBox("PluginSdk;bin\homeseer\PluginSdk.dll")
    End Sub
    Private Sub btnGlobalMethods_Click(sender As Object, e As EventArgs) Handles btnGlobalMethods.Click
        '' Add reference to tenGlobalMethods to the Current ScriptingReference text box
        AddReferenceToTextBox("tenGlobalMethods;tenGlobalMethods.dll")
    End Sub
    Private Sub AddReferenceToTextBox(NewReference As String)
        Dim s1 As String
        s1 = txtCurrentScriptingReference.Text.Trim
        If s1.Length < 2 Then
            '' No current entry
            txtCurrentScriptingReference.Text = NewReference
        Else
            '' An entry already exists
            If s1.ToUpper.Contains(NewReference.ToUpper) Then
                '' New entry already in the current entry
                MessageBox.Show(NewReference & vbCrLf & vbCrLf & "already exists in the current ScriptingReferences entry", "tenScripting4", MessageBoxButtons.OK)
                Exit Sub
            Else
                '' New entry is not already in current entry
                txtCurrentScriptingReference.Text = s1 & "," & NewReference   'add new reference to the end
            End If

        End If
    End Sub
    Private Sub frmScriptingReference_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        chkCheckAtStartup.Checked = My.Settings.CheckScriptingReferences

    End Sub

    Private Sub frmScriptingReference_Enter(sender As Object, e As EventArgs) Handles MyBase.Enter
        If txtCurrentScriptingReference.Text.ToUpper.Contains("PLUGINSDK") Then
            lblPluginSDKRefNotFound.Hide()
        Else
            If Not VersionGreaterThan_4_1_13 Then
                lblPluginSDKRefNotFound.Show()
            End If
        End If
    End Sub

    Private Sub frmScriptingReference_MouseEnter(sender As Object, e As EventArgs) Handles MyBase.MouseEnter
        If txtCurrentScriptingReference.Text.ToUpper.Contains("PLUGINSDK") Then
            lblPluginSDKRefNotFound.Hide()
        Else
            If Not VersionGreaterThan_4_1_13 Then
                lblPluginSDKRefNotFound.Show()
            End If
        End If
    End Sub

    Private Sub chkCheckAtStartup_CheckedChanged(sender As Object, e As EventArgs) Handles chkCheckAtStartup.CheckedChanged
        My.Settings.CheckScriptingReferences = chkCheckAtStartup.Checked
        My.Settings.Save()
    End Sub

    Private Sub btnRewrite_Click(sender As Object, e As EventArgs) Handles btnRewrite.Click
        Dim s1 As String
        s1 = txtCurrentScriptingReference.Text.Trim
        hs4.SaveINISetting("Settings", "ScriptingReferences", s1, "settings.ini")
        Me.Close()
    End Sub

    Private Sub btnSQLite_Click(sender As Object, e As EventArgs) Handles btnSQLite.Click
        '' Add reference to SQLite to the Current ScriptingReference text box
        AddReferenceToTextBox("System.Data.SQLite;bin\homeseer\System.Data.SQLite.dll")
    End Sub

End Class