I have created practically an entire project...and now realise that i have done it all wrong. that it should be in 2 parts, and quite honestly, i havent a clue how to do it.
I have to have:
VB.NET Windows Component Specification
The radio component software should function as follows.
On start-up the radio will be “off”.
The user can switch the radio “on”, in which case it will begin to play the currently selected station (the last station selected before the radio was switched off).
The radio can be tuned one of two modes, either AM or FM. The user can switch between these modes at any time
The user can “scan” for alternative stations.
The user can “cancel scanning” at any time, in which case the radio will resume playing the last station it was tuned to before scanning started.
In scan mode the radio will scan through frequencies pausing for 3 seconds when a station is found.
When a station is found the user can “select” that station. If this happens the selected station becomes the current station and it is played.
The list of radio station frequencies and their “smart names” and mode, e.g., 1548 MW Forth 2, will be stored internally in the software and not in an external file. The radio should be able to tune to at least twenty stations.
The details of the last station played before the radio is switched off should be stored in an external text file.
The radio will be able to accept a smart name from the user and tune to that station.
The radio will be able to pass to the user the frequency, mode, and smart name of the station currently being played
and
VB.NET Application Specification
The radio application software should function as follows.
The user application will be able to retrieve from the component the frequency, mode, and smart name of the station currently being played.
The user application can choose to store any station the radio can be tuned to in a “favourites” list.
The favourites list will be stored in a MS Access database
This info will be stored in the form of frequency, mode (AM or FM), and smart name.
The user application will be able to send to the component the frequency, mode, and smart name of any station the radio can be tuned to.
The user application can browse the favourites list at any time and select from it a station to be played.
Any other feature you, as application designer, consider to be useful
I have absolutely no idea what im doing.
the radio component must be in the form of a .dll file
PLEASE can someone help me, i have little over a week to complete this project and i have no idea what to do anymore.
Here is the code i have for the project i have created so far:
Form1:
CODE
Private Sub btnPower_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPower.Click
If Mode = ModeEnum.OffMode Then
Mode = ModeEnum.OnMode
AxMediaPlayer1.FileName = "c:\cwmusic\ChrisBrown.mp3"
Else
Mode = ModeEnum.OffMode
AxMediaPlayer1.Stop()
Dim sw As New IO.StreamWriter("c:\lastStation.txt")
sw.Write(radioStations(0).ToString)
sw.Close()
End If
SetMode(Me, Mode)
End Sub
Dim radioStations(19) As Station
Private Mode As ModeEnum = ModeEnum.OffMode
Enum ModeEnum
OnMode
OffMode
End Enum
Sub SetMode(ByVal ctl As Control, ByVal mode As ModeEnum)
Dim blnEnabled As Boolean = (mode = ModeEnum.OnMode)
For Each subCtl As Control In ctl.Controls
If Not subCtl.Name = "btnPower" Then
subCtl.Enabled = blnEnabled
End If
If subCtl.HasChildren Then SetMode(subCtl, mode)
Next
End Sub
Private Sub TckbarVolume_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TckbarVolume.Scroll
AxMediaPlayer1.Volume = TckbarVolume.Value * 10
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SetMode(Me, ModeEnum.OffMode)
Dim fileName As String = "C:\lastStation.txt"
Dim textLine As String = String.Empty
Try
If System.IO.File.Exists("C:\lastStation.txt") Then
Dim reader As New System.IO.StreamReader(fileName)
Do While reader.Peek() <> -1
textLine += reader.ReadLine()
textLine += Environment.NewLine()
Loop
Else
textLine = "File not found!"
End If
Catch Ex As Exception
textLine = Ex.Message
End Try
lblStationInfo.Text = textLine
radioStations(0) = New Station("Classic Rock", "http://www.cfm.com", RadioBand.FM)
radioStations(0).SongName = "c:\cwmusic\Kylie.mp3"
radioStations(1) = New Station("Carly's Test", "http://www.cfm.com", RadioBand.AM)
radioStations(1).SongName = "c:\cwmusic\Snowpatrol.mp3"
radioStations(2) = New Station("Carly's Test Station2", "http://www.cfm.com", RadioBand.FM)
radioStations(2).SongName = "c:\cwmusic\Kylie.mp3"
End Sub
Private Sub btnScan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnScan.Click
AxMediaPlayer1.Mute = True
Dim oForm As New Form2
oForm.ShowDialog()
AxMediaPlayer1.Mute = False
End Sub
Private Sub btnMute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMute.Click
If AxMediaPlayer1.Mute Then
AxMediaPlayer1.Mute = False
Else
AxMediaPlayer1.Mute = True
End If
End Sub
Private Sub radiobtnAM_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radiobtnAM.CheckedChanged
If radiobtnAM.Checked Then
Module1.AM = True
Else
Module1.AM = False
End If
End Sub
Private Sub radiobtnFM_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radiobtnFM.CheckedChanged
If radiobtnFM.Checked Then
Module1.AM = False
Else
Module1.AM = True
End If
End Sub
Private Sub Station1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Station1.Click
AxMediaPlayer1.FileName = "c:\cwmusic\Ronan.mp3"
lblStationInfo.Text = radioStations(0).ToString()
End Sub
Private Sub Station2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Station2.Click
AxMediaPlayer1.FileName = "c:\cwmusic\Snowpatrol.mp3"
lblStationInfo.Text = radioStations(1).ToString()
End Sub
Private Sub station3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles station3.Click
AxMediaPlayer1.FileName = "c:\cwmusic\Kylie.mp3"
lblStationInfo.Text = radioStations(2).ToString()
End Sub
Public Class Station
Private InfoText As String
Private URL As String
Private Band As RadioBand
Private song As String
Public Sub New()
End Sub
Public Sub New(ByVal InfoText As String, _
ByVal URL As String, _
ByVal Band As RadioBand)
Me.InfoText = InfoText
Me.URL = URL
Me.Band = Band
End Sub
Public Property SongName()
Get
Return song
End Get
Set(ByVal value)
song = value
End Set
End Property
Public Overrides Function ToString() As String
Return Me.InfoText
End Function
End Class
Public Enum RadioBand
FM = 0
AM = 1
End Enum
End Class
And Form2:
CODE
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
Timer1.Enabled = False
AxMediaPlayer1.FileName = ""
Me.Close()
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim fileName As String = "C:\yourLocation.txt"
Dim textLine As String = String.Empty
Try
If System.IO.File.Exists("C:\yourLocation.txt") Then
Dim reader As New System.IO.StreamReader(fileName)
Do While reader.Peek() <> -1
textLine += reader.ReadLine()
textLine += Environment.NewLine()
Loop
Else
textLine = "File not found!"
End If
Catch Ex As Exception
textLine = Ex.Message
End Try
lblStationInfo.Text = textLine
End Sub
Private Sub scrollbarStations_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles scrollbarStations.ValueChanged
Select Case scrollbarStations.Value
Case 1
If Module1.AM Then
lblStationInfo.Text = "First Radio 2345 MW"
AxMediaPlayer1.FileName = "c:\cwmusic\Kylie.mp3"
Else
lblStationInfo.Text = "Testing Radio 2335 FM"
AxMediaPlayer1.FileName = "c:\cwmusic\Robyn.mp3"
End If
Case 2
lblStationInfo.Text = "Second Radio 6654 MW"
AxMediaPlayer1.FileName = "c:\cwmusic\Cascada.mp3"
Case 3
lblStationInfo.Text = "Third Radio 7563 MW"
AxMediaPlayer1.FileName = "c:\cwmusic\Nickleback.mp3"
End Select
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If scrollbarStations.Value < scrollbarStations.Maximum Then
scrollbarStations.Value = scrollbarStations.Value + 1
End If
End Sub
Private Sub radiobtnAM_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radiobtnAM.CheckedChanged
If radiobtnAM.Checked Then
Module1.AM = True
Else
Module1.AM = False
End If
End Sub
Private Sub radiobtnFM_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radiobtnFM.CheckedChanged
If radiobtnFM.Checked Then
Module1.AM = False
Else
Module1.AM = True
End If
End Sub
Private Sub btnSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelect.Click
Timer1.Enabled = False
Select Case scrollbarStations.Value
Case 1
lblStationInfo.Text = "Test for Form1&2 6654 MW"
AxMediaPlayer1.FileName = "c:\cwmusic\Cascada.mp3"
Me.Close()
End Select
End Sub
End Class
Please Someone out there, please help me, im extremely stuck and desperate...i dont even know whats being asked for now...please help!!!