⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainform.vb

📁 一个界面很好的iRadio收音机 一个界面很好的iRadio收音机
💻 VB
📖 第 1 页 / 共 5 页
字号:
                                "Please download and install the latest version of Windows Media Player from Microsoft?" & vbCrLf & vbCrLf & _
                                My.Application.Info.Title & " will now close.", My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error)
                ' Exit application
                NotifyIcon1.Dispose()
                AppExit()
            End Try

            ' Check for Internet connectivity.
            If My.Computer.Network.IsAvailable = False Then
                Dim result As DialogResult

                result = MessageBox.Show("Your computer does not appear to be connected to the Internet." & vbCrLf & _
                                         "This program will not work without an Internet connection." & vbCrLf & vbCrLf & _
                                         "Do you want to run this program anyway?", My.Application.Info.Title, _
                                         MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
                If result = Windows.Forms.DialogResult.No Then
                    NotifyIcon1.Dispose()
                    AppExit()
                End If
            End If

            ' Set title and icon.
            lblHeader.Text = My.Application.Info.Title
            Me.Icon = My.Resources.iRadio

            ' Set tooltip properties.
            ToolTip1.AutomaticDelay = 500
            ToolTip1.InitialDelay = 250
            ToolTip1.IsBalloon = False
            ToolTip1.ReshowDelay = 1000
            ToolTip1.ShowAlways = True
            ToolTip1.ToolTipIcon = ToolTipIcon.None
            ToolTip1.ToolTipTitle = ""
            ToolTip1.UseAnimation = True
            ToolTip1.UseFading = True

            ' Use custom error messages for media player.
            Player.settings.enableErrorDialogs = False

            ' Set options and do initialization.
            SetOptions()

        Catch ex As InvalidComObjectException
            ' If error occurs, cancel topmost.
            If Me.TopMost = True Then Me.TopMost = False

            MessageBox.Show("An unhandled error has occurred in " & My.Application.Info.Title & vbCrLf & _
                "The system returned the following information:" & vbCrLf & ex.Message, _
                My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try

    End Sub

#End Region

#Region " Form Menu Events "

    Private Sub mnuExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuExit.Click
        NotifyIcon1.Dispose()
        AppExit()
    End Sub

    Private Sub mnuOpenUrl_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuOpenUrl.Click
        Dim result As DialogResult

        ' Form can't be topmost when other form is shown.
        If Settings.KeepOnTop = True Then
            Me.TopMost = False
        End If

        result = UrlDialog.ShowDialog()

        ' Make form topmost again, if set.
        If Settings.KeepOnTop = True Then
            Me.TopMost = True
        End If

        ' This try/catch is here to make sure mOpenUrl is reset.
        Try
            If result = Windows.Forms.DialogResult.OK Then
                ' If combobox is not empty, try playing the URL.
                Dim url As String = UrlDialog.txtUrl.Text
                If url <> "" Then
                    ' Setup form-level variables.
                    mSelectedName = "URL"
                    mSelectedLocation = ""
                    mSelectedFormat = ""
                    mSelectedWebsite = ""
                    mSelectedUri = url

                    ' Set open url flag so that error messages don't prompt to remove entry.
                    mOpenUrl = True

                    ' Clear any selected radiobuttons and try to play the url.
                    ClearRadioButtons(Me)
                    PlaySelectedStation()
                End If
            End If
        Catch ex As NullReferenceException
        Finally
            ' Reset open url flag.
            mOpenUrl = False
        End Try

    End Sub

    Private Sub mnuBlue_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuBlue.Click
        If Settings.Color <> "Blue" Then
            mnuBlue.Image = My.Resources.Checked
            mnuCyan.Image = Nothing
            mnuFuchsia.Image = Nothing
            mnuGray.Image = Nothing
            mnuGreen.Image = Nothing
            mnuOrange.Image = Nothing
            mnuRed.Image = Nothing
            mnuTeal.Image = Nothing
            Settings.Color = "Blue"
            My.Settings.Color = "Blue"
            My.Settings.Save()
            SetColor(Me, "Blue")
        End If
    End Sub

    Private Sub mnuCyan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuCyan.Click
        If Settings.Color <> "Cyan" Then
            mnuBlue.Image = Nothing
            mnuCyan.Image = My.Resources.Checked
            mnuFuchsia.Image = Nothing
            mnuGray.Image = Nothing
            mnuGreen.Image = Nothing
            mnuOrange.Image = Nothing
            mnuRed.Image = Nothing
            mnuTeal.Image = Nothing
            Settings.Color = "Cyan"
            My.Settings.Color = "Cyan"
            My.Settings.Save()
            SetColor(Me, "Cyan")
        End If
    End Sub

    Private Sub mnuFuchsia_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFuchsia.Click
        If Settings.Color <> "Fuchsia" Then
            mnuBlue.Image = Nothing
            mnuCyan.Image = Nothing
            mnuFuchsia.Image = My.Resources.Checked
            mnuGray.Image = Nothing
            mnuGreen.Image = Nothing
            mnuOrange.Image = Nothing
            mnuRed.Image = Nothing
            mnuTeal.Image = Nothing
            Settings.Color = "Fuchsia"
            My.Settings.Color = "Fuchsia"
            My.Settings.Save()
            SetColor(Me, "Fuchsia")
        End If
    End Sub

    Private Sub mnuGray_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuGray.Click
        If Settings.Color <> "Gray" Then
            mnuBlue.Image = Nothing
            mnuCyan.Image = Nothing
            mnuFuchsia.Image = Nothing
            mnuGray.Image = My.Resources.Checked
            mnuGreen.Image = Nothing
            mnuOrange.Image = Nothing
            mnuRed.Image = Nothing
            mnuTeal.Image = Nothing
            Settings.Color = "Gray"
            My.Settings.Color = "Gray"
            My.Settings.Save()
            SetColor(Me, "Gray")
        End If
    End Sub

    Private Sub mnuGreen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuGreen.Click
        If Settings.Color <> "Green" Then
            mnuBlue.Image = Nothing
            mnuCyan.Image = Nothing
            mnuFuchsia.Image = Nothing
            mnuGray.Image = Nothing
            mnuGreen.Image = My.Resources.Checked
            mnuOrange.Image = Nothing
            mnuRed.Image = Nothing
            mnuTeal.Image = Nothing
            Settings.Color = "Green"
            My.Settings.Color = "Green"
            My.Settings.Save()
            SetColor(Me, "Green")
        End If
    End Sub

    Private Sub mnuOrange_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuOrange.Click
        If Settings.Color <> "Orange" Then
            mnuBlue.Image = Nothing
            mnuCyan.Image = Nothing
            mnuFuchsia.Image = Nothing
            mnuGray.Image = Nothing
            mnuGreen.Image = Nothing
            mnuOrange.Image = My.Resources.Checked
            mnuRed.Image = Nothing
            mnuTeal.Image = Nothing
            Settings.Color = "Orange"
            My.Settings.Color = "Orange"
            My.Settings.Save()
            SetColor(Me, "Orange")
        End If
    End Sub

    Private Sub mnuRed_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuRed.Click
        If Settings.Color <> "Red" Then
            mnuBlue.Image = Nothing
            mnuCyan.Image = Nothing
            mnuFuchsia.Image = Nothing
            mnuGray.Image = Nothing
            mnuGreen.Image = Nothing
            mnuOrange.Image = Nothing
            mnuRed.Image = My.Resources.Checked
            mnuTeal.Image = Nothing
            Settings.Color = "Red"
            My.Settings.Color = "Red"
            My.Settings.Save()
            SetColor(Me, "Red")
        End If
    End Sub

    Private Sub mnuTeal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuTeal.Click
        If Settings.Color <> "Teal" Then
            mnuBlue.Image = Nothing
            mnuCyan.Image = Nothing
            mnuFuchsia.Image = Nothing
            mnuGray.Image = Nothing
            mnuGreen.Image = Nothing
            mnuOrange.Image = Nothing
            mnuRed.Image = Nothing
            mnuTeal.Image = My.Resources.Checked
            Settings.Color = "Teal"
            My.Settings.Color = "Teal"
            My.Settings.Save()
            SetColor(Me, "Teal")
        End If
    End Sub

    Private Sub mnuAutoPlay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAutoPlay.Click
        If Settings.AutoPlay = True Then
            Settings.AutoPlay = False
            mnuAutoPlay.Image = Nothing
        ElseIf Settings.AutoPlay = False Then
            Settings.AutoPlay = True
            mnuAutoPlay.Image = My.Resources.Checked
        End If

        ' Save setting.
        My.Settings.AutoPlay = Settings.AutoPlay
        My.Settings.Save()
    End Sub

    Private Sub mnuKeepOnTop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuKeepOnTop.Click
        If Settings.KeepOnTop = True Then
            Settings.KeepOnTop = False
            Me.TopMost = False
            mnuKeepOnTop.Image = Nothing
        ElseIf Settings.KeepOnTop = False Then
            Settings.KeepOnTop = True
            Me.TopMost = True
            mnuKeepOnTop.Image = My.Resources.Checked
        End If

        ' Save setting.
        My.Settings.KeepOnTop = Settings.KeepOnTop
        My.Settings.Save()
    End Sub

    Private Sub mnuDisplaySplashScreen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuDisplaySplashScreen.Click
        ' If DisplaySplash is False, make DisplayVideo False too.
        If Settings.DisplaySplashScreen = True Then
            Settings.DisplaySplashScreen = False
            mnuDisplaySplashScreen.Image = Nothing
        ElseIf Settings.DisplaySplashScreen = False Then
            Settings.DisplaySplashScreen = True
            mnuDisplaySplashScreen.Image = My.Resources.Checked
        End If

        ' Save setting.
        My.Settings.DisplaySplashScreen = Settings.DisplaySplashScreen
        My.Settings.Save()
    End Sub

    ''' <summary>
    ''' User has a choice of Cover Art or Visualizations or neither.
    ''' </summary>
    Private Sub mnuDisplayCoverArt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuDisplayCoverArt.Click
        If Settings.DisplayCoverArt = True Then
            Settings.DisplayCoverArt = False
            mnuDisplayCoverArt.Image = Nothing
            ' Enable timer and change interval so change is made.
            tmrRotatePictureText.Enabled = True
            tmrRotatePictureText.Interval = 5000
        ElseIf Settings.DisplayCoverArt = False Then
            Settings.DisplayCoverArt = True
            mnuDisplayCoverArt.Image = My.Resources.Checked
            ' Download the image.
            DownloadImage()
            ' Enable timer and change interval so change is made.
            tmrRotatePictureText.Enabled = True
            tmrRotatePictureText.Interval = 5000
            ' Only cover art or visualizations can be enabled.
            If Settings.DisplayVisualizations = True Then
                Settings.DisplayVisualizations = False
                mnuDisplayVisualizations.Image = Nothing
            End If
        End If

        ' Save settings.
        My.Settings.DisplayCoverArt = Settings.DisplayCoverArt
        My.Settings.DisplayVisualizations = Settings.DisplayVisualizations
        My.Settings.Save()
    End Sub

    ''' <summary>
    ''' User has a choice of Cover Art or Visualizations or neither.
    ''' </summary>
    Private Sub mnuDisplayVisualizations_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuDisplayVisualizations.Click
        If Settings.DisplayVisualizations = True Then
            Settings.DisplayVisualizations = False
            mnuDisplayVisualizations.Image = Nothing
            ' Enable timer and change interval so change is made.
            tmrRotatePictureText.Enabled = True
            tmrRotatePictureText.Interval = 5000
        ElseIf Settings.DisplayVisualizations = False Then
            Settings.DisplayVisualizations = True
            mnuDisplayVisualizations.Image = My.Resources.Checked
            ' Enable timer and change interval so change is made.
            tmrRotatePictureText.Enabled = True
            tmrRotatePictureText.Interval = 5000
            ' Only cover art or visualizations can be enabled.
            If Settings.DisplayCoverArt = True Then

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -