Exemplo n.º 1
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            //Check if the user has entered any text
            if (string.IsNullOrEmpty(SearchText.Text))
            {
                return;
            }
            //Show wait window
            WaitLabel.Focus();
            WaitLabel.Visible = true;
            WaitLabel.Enabled = true;
            ArrayList Station_List = Search(SearchText.Text);

            WaitLabel.Enabled = false;
            WaitLabel.Visible = false;
            if (Station_List == null)
            {
                MessageBox.Show(this, "No stations found please search again.");
                return;
            }
            if (ResultsBox.Items != null)
            {
                ResultsBox.Items.Clear();
            }
            foreach (SHOUTcastStation station in Station_List)
            {
                SHOUTcastStation radiostation = new SHOUTcastStation();
                radiostation.name    = station.name;
                radiostation.url     = station.url;
                radiostation.bitrate = station.bitrate;
                ListViewItem listItem = new ListViewItem(new string[]
                {
                    radiostation.bitrate.ToString(),
                    radiostation.name,
                    radiostation.url
                });
                listItem.Tag = radiostation;
                if (ResultsBox.Items != null)
                {
                    ResultsBox.Items.Add(listItem);
                }
            }
            ResultsBox.Focus();
        }