示例#1
0
        private void btDownloadSongs_Click(object sender, EventArgs e)
        {
            _files = new List <MusicFile>();
            var songs = browser.Document.GetElementById("0songContainer");

            if (songs == null)
            {
                ShowError(); return;
            }
            var table = songs.Children[0];

            for (int i = 0; i < table.Children.Count; i++)
            {
                var songRow = table.Children[i];
                _files.Add(new MusicFile()
                {
                    Id = songRow.Id.Split('_')[1], Title = table.Children[i].Children[0].Children[0].InnerText, Artist = table.Children[i].Children[2].Children[0].InnerText, Album = table.Children[i].Children[3].Children[0].InnerText
                });
            }
            if (_files.Count == 0)
            {
                ShowError();
            }
            else
            {
                this.browser.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.browser_DocumentCompleted);
                _downloadWindow = new DownloadWindow(_files, this);
            }
        }
 private void btDownloadSongs_Click(object sender, EventArgs e)
 {
     _files = new List<MusicFile>();
     var songs = browser.Document.GetElementById("0songContainer");
     if (songs == null) { ShowError(); return; }
     var table = songs.Children[0];
     for (int i = 0; i < table.Children.Count; i++)
     {
         var songRow = table.Children[i];
         _files.Add(new MusicFile() { Id = songRow.Id.Split('_')[1], Title = table.Children[i].Children[0].Children[0].InnerText, Artist = table.Children[i].Children[2].Children[0].InnerText, Album = table.Children[i].Children[3].Children[0].InnerText });
     }
     if (_files.Count == 0) { ShowError(); }
     else
     {
         this.browser.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.browser_DocumentCompleted);
         _downloadWindow = new DownloadWindow(_files, this);
     }
 }