void m_SelectingMedia_ItemClick(object sender, SelectForm.SelectingMedia.SelectingMediaEventArgs e) { SelectedMedia.AddResult result = m_SelectedMedia.AddMedia(e.Item); switch (result) { case SelectedMedia.AddResult.MediaExistInPlaylist: { ApplicationMessage.Show(this, m_MediaExistInPlaylist); break; } case SelectedMedia.AddResult.MoneyNotEnought: { ApplicationMessage.Show(this, m_strMoneyNotEnough); break; } case SelectedMedia.AddResult.OK: { break; } default: { Debug.Assert(false); break; } } }
//Start private void pictureBox3_Click(object sender, EventArgs e) { if (searchWorker.IsBusy) { return; } Debug.Assert(m_strSearch.Length >= 0); if (m_strSearch.Length == 0) { ApplicationMessage.Show(this, m_SearchStringNotPassedMsg); return; } EnableControlsDel enableControlsDel = delegate(Boolean enable) { foreach (Control ctrl in Controls) { if (ctrl != pbSearchStatus) { ctrl.Enabled = enable; } } }; enableControlsDel(false); searchWorker = new BackgroundWorker(); searchWorker.DoWork += new DoWorkEventHandler(StartSearch); searchWorker.WorkerReportsProgress = true; searchWorker.ProgressChanged += delegate(object sender1, ProgressChangedEventArgs e1) { pbSearchStatus.Value = e1.ProgressPercentage; }; searchWorker.RunWorkerCompleted += delegate(object sender2, RunWorkerCompletedEventArgs e2) { if (e2.Error != null) { throw e2.Error; } enableControlsDel(true); Search.SearchResults searchResults = (Search.SearchResults)e2.Result; if (searchResults.Directories.Count > 0 || searchResults.Files.Count > 0) { m_Results = searchResults; DialogResult = DialogResult.OK; Close(); } else { ApplicationMessage.Show(this, m_NothingFoundMsg); } }; searchWorker.RunWorkerAsync(m_strSearch); }