Public Class Menu

    Private Sub btnNew_Click(sender As System.Object, e As System.EventArgs) Handles btnNew.Click
        Me.DialogResult = Windows.Forms.DialogResult.Yes
    End Sub

    Private Sub btnOpen_Click(sender As System.Object, e As System.EventArgs) Handles btnOpen.Click
        Me.DialogResult = Windows.Forms.DialogResult.No
    End Sub

    Private Sub btnExit_Click(sender As System.Object, e As System.EventArgs) Handles btnExit.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
    End Sub

    Private Sub Menu_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        lblAppInfo.Text = String.Format("{0} v {1}", Application.ProductName, Application.ProductVersion)
        'lblCopyright.Text = String.Format("{0}", Application.Copyright)
        'chkEnablePR.Checked = My.Settings.PREnabled
        chkForceUSA.Checked = My.Settings.ForceUS
        chkCourtesy.Checked = My.Settings.CourtesyDelay
    End Sub

    Private Sub chkEnablePR_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkEnablePR.CheckedChanged
        'Dim chkBox = TryCast(sender, CheckBox)

        'If chkBox IsNot Nothing Then
        '    My.Settings.PREnabled = chkBox.Checked
        '    My.Settings.Save()
        'End If
    End Sub

    Private Sub chkForceUSA_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkForceUSA.CheckedChanged
        Dim chkBox = TryCast(sender, CheckBox)

        If chkBox IsNot Nothing Then
            My.Settings.ForceUS = chkBox.Checked
            My.Settings.Save()
        End If
    End Sub

    Private Sub chkCourtesy_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkCourtesy.CheckedChanged
        Dim chkBox = TryCast(sender, CheckBox)

        If chkBox IsNot Nothing Then
            My.Settings.CourtesyDelay = chkBox.Checked
            My.Settings.Save()
        End If
    End Sub

    Private Sub lnkHelpPR_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkHelpPR.LinkClicked
        MessageBox.Show("If checked the software will look up the Google PageRank of each URL result. This makes the searches take extra time and may cause your IP address to be temporarily blocked by Google if you run the software with too many keywords at once.", "PageRank Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
    End Sub

    Private Sub lnkHelpUSA_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkHelpUSA.LinkClicked
        MessageBox.Show("If checked the software will request results as if you were located in the USA. If you're not in the USA and are having trouble getting EDU or GOV links, enabling this can help.", "Force USA Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
    End Sub

    Private Sub lnkCourtesy_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lnkCourtesy.LinkClicked
        MessageBox.Show("If checked the software will wait between search requests. This will make a search take longer to run, but may prevent getting your IP temporarily banned. Enable this option if you are planning to run a lot of searches, or a large list of keywords", "Courtesy Delay Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
    End Sub
End Class