/// <summary> /// Event handler of the search button for showing list of songs and manupulating buttons on MainWindow /// </summary> private async void SearchButton_Click(object sender, RoutedEventArgs e) { ClearSongBox(); SwitchingButtons.Visibility = Visibility.Visible; string querySongName = textBox.Text; loader = new HtmlLoader(new ParserSettings()); parser = new Parser(); try { songs = parser.Parse(await loader.LoadDocumentAsync(querySongName)).ToList(); } catch (ArgumentNullException) { errorMessage.Visibility = Visibility.Visible; return; } songNameLabels = songs.Select(song => new Label { Content = song.Name, FontFamily = new FontFamily("Microsoft YaHei UI Light") }).ToList(); songDurationLabels = songs.Select(song => new Label { Content = song.Duration, FontFamily = new FontFamily("Microsoft YaHei UI Light") }).ToList(); songDownloadButtons = songs.Select(song => new Button { Content = "Скачать", Tag = song.DownloadLink + "_%_" + song.Name + ".mp3", FontFamily = new FontFamily("Microsoft YaHei UI Light") }).ToList(); CheckForDownloadedSongs(); showSongsOnWindow(currentSongsPage); }