private void SetPage(int page) { webtoonPageList.Controls.Clear( ); WebtoonIndexPage selectedPage = indexPages[page - 1]; StartLoadingMode( ); if (loadThread != null) { loadThread.Abort( ); loadThread = null; } loadThread = new Thread(() => { int count = 0; int y = 0; foreach (WebtoonPageInformation info in selectedPage.page) { count++; WebtoonListChild child = new WebtoonListChild(info); child.Location = new Point(0, y); if (this.InvokeRequired) { this.Invoke(new Action(() => { webtoonPageList.Controls.Add(child); loadingStatusLabel.Text = "데이터를 불러오고 있습니다 ... " + ( int )((( float )count / ( float )selectedPage.page.Count) * 100) + "%"; })); } else { webtoonPageList.Controls.Add(child); loadingStatusLabel.Text = "데이터를 불러오고 있습니다 ... " + ( int )((( float )count / ( float )selectedPage.page.Count) * 100) + "%"; } y += child.Size.Height + 5; } Thread.Sleep(1000); if (this.InvokeRequired) { this.Invoke(new Action(() => StopLoadingMode( ))); } else { StopLoadingMode( ); } }) { IsBackground = true }; loadThread.Start( ); }
private void DOWNLOAD_BUTTON_Click(object sender, EventArgs e) { Webtoon.DownloadBlockList.Clear( ); int count = 0; for (int i = 0; i < webtoonPageList.Controls.Count; i++) { WebtoonListChild webtoonListChild = ( WebtoonListChild )webtoonPageList.Controls[i]; if (webtoonListChild.blocked) { Webtoon.DownloadBlockList.Add(webtoonListChild.info.num); count++; } } if (count >= baseInformation.pages.Count) { NotifyBox.Show(this, "오류", "최소 1개의 화는 다운받아야 합니다.", NotifyBoxType.OK, NotifyBoxIcon.Error); return; } FolderBrowserDialog dialog = new FolderBrowserDialog( ) { ShowNewFolderButton = true, Description = "해당 웹툰을 어디에 저장하시겠습니까?" }; if (dialog.ShowDialog( ) == DialogResult.OK) { Webtoon.BaseDirectory = dialog.SelectedPath; DownloadOptionReturn.Invoke(DownloadOptionResult.DownloadClick, null); } }
private void PageSearch(string searchText) { int newY = 0; webtoonPageList.VerticalScroll.Value = webtoonPageList.VerticalScroll.Minimum; // 현재 스크롤을 Minimum 값으로 변경 if (searchText == "") { for (int i = 0; i < webtoonPageList.Controls.Count; i++) { WebtoonListChild webtoonListChild = ( WebtoonListChild )webtoonPageList.Controls[i]; webtoonListChild.Location = new Point(0, newY); webtoonListChild.Visible = true; newY += 90 + 5; } temp.Clear( ); return; } for (int i = 0; i < webtoonPageList.Controls.Count; i++) { WebtoonListChild webtoonListChild = ( WebtoonListChild )webtoonPageList.Controls[i]; // 다운로드 차단된 화 이면 건너뜀 if (webtoonListChild.blocked) { webtoonListChild.Visible = false; continue; } // temp 에 해당 컨트롤이 포함되어 있으면 if (temp.Contains(webtoonListChild)) { // 그것은 이전에 검색에 포함되어 Y 위치가 변경된 컨트롤이니 이전의 위치로 변경. (초기화) webtoonPageList.Controls[i].Location = new Point(0, webtoonListChild.Location.Y); // temp 에서 지우기 temp.Remove(webtoonListChild); } // 검색어가 화 제목(info.title)에 포함되어있는지 검색 if (webtoonListChild.info.title.Contains(searchText)) { // webtoonPageList.ScrollControlIntoView( webtoonListChild ); // 이전의 위치를 알아내기 위해 temp 에 백업 temp.Add(webtoonListChild); // Y 위치를 재설정 webtoonListChild.Location = new Point(0, newY); webtoonListChild.Visible = true; webtoonListChild.Highlight( ); newY += 90 + 5; } else { webtoonListChild.Visible = false; } } }