コード例 #1
0
ファイル: Form1.cs プロジェクト: IvanFilofeev/MusicPlayer
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            this.Invoke((MethodInvoker)delegate
                {
                    try
                    {
                        ListWithURLs = axWindowsMediaPlayer1.playlistCollection.newPlaylist("vkPlayList");

                    SearchEngine engine = new SearchEngine(textBox1.Text);
                    engine.Search();
                    listBox2.Items.Add(engine.GetFiles());

                    axWindowsMediaPlayer1.currentPlaylist = ListWithURLs;
                    axWindowsMediaPlayer1.Ctlcontrols.stop();
                    }
                    catch { }

                });
        }
コード例 #2
0
        private void LoadSearcResult()
        {
            Thread.Sleep(TimeSpan.FromSeconds(2));

            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                (ThreadStart)delegate ()
                {
                    SearchEngine engine = new SearchEngine(TextBoxSearch.Text);
                    engine.Search();
                    _Result = engine.GetFiles();
                    _ResultUrls = engine.GetUrls();
                    ListWithURLs = activeXMediaPlayer.playlistCollection.newPlaylist("vkPlayList");

                    for (int i = 0; i < _ResultUrls.Count(); i++)
                    {

                        URL = activeXMediaPlayer.newMedia(_ResultUrls[i]);
                        ListWithURLs.appendItem(URL);

                    }
                    activeXMediaPlayer.currentPlaylist = ListWithURLs;
                    activeXMediaPlayer.Ctlcontrols.stop();

                    ListBoxSearch.ItemsSource = engine.GetFiles();

                }
                );
        }