private void Add_button_Click(object sender, EventArgs e) { if (title != null) { var checkedIndexes = chapterList_checkedListBox.CheckedIndices; List <int> ChapterNumberForDownload = new List <int>(); foreach (int indexChecked in checkedIndexes) { ChapterNumberForDownload.Add(indexChecked + 1); } string pathToDownload = PathToDownload_textBox.Text; TaskDownloadTitle downloadTask = new TaskDownloadTitle(title, ChapterNumberForDownload, pathToDownload); Close(); TitleAdded?.Invoke(downloadTask); } }
private void Add_Click(object sender, RoutedEventArgs e) { if (title != null) { List <int> ChapterNumberForDownload = new List <int>(); for (int i = 0; i < ChapterListBox.Items.Count; i++) { var checkBox = ((CheckBox)ChapterListBox.Items[i]); if (checkBox.IsChecked.Value) { ChapterNumberForDownload.Add(i + 1); } } TaskDownloadTitle downloadTask = new TaskDownloadTitle(title, ChapterNumberForDownload, @"C:\Users\Vasiliy\Documents\Manga"); Close(); TitleAdded?.Invoke(downloadTask); } }