private void CallbackThumbnail(object sender, AsyncCompletedEventArgs e) { PicElement pe = new PicElement(this); Tuple <string, HitomiArticle> tuple = (Tuple <string, HitomiArticle>)e.UserState; pe.Article = tuple.Item2; pe.Label = tuple.Item2.Title; pe.Dock = DockStyle.Bottom; pe.SetImageFromAddress(tuple.Item1, 150, 200); if (closed) { pe.Dispose(); LogEssential.Instance.PushLog(() => $"Unexpected Disposed! {HitomiDef.HitomiThumbnail + tuple.Item2.Thumbnail} {tuple.Item1}"); return; } pe.Font = this.Font; lock (stayed) { // 중복되는 항목 처리 foreach (var a in stayed) { if (a.Article.Title == pe.Article.Title) { pe.Article.Title += " " + pe.Article.Magic; pe.Label += " " + pe.Article.Magic; break; } } stayed.Add(pe); } AddPe(pe); IncrementProgressBarValue(); Application.DoEvents(); LogEssential.Instance.PushLog(() => $"Downloaded image! {HitomiDef.HitomiThumbnail + tuple.Item2.Thumbnail} {tuple.Item1}"); }
private void CallbackThumbnail(object sender, AsyncCompletedEventArgs e) { PicElement pe = new PicElement(this); Tuple <string, HitomiArticle> tuple = (Tuple <string, HitomiArticle>)e.UserState; pe.Article = tuple.Item2; pe.Label = tuple.Item2.Title; pe.Dock = DockStyle.Bottom; pe.SetImageFromAddress(tuple.Item1, 150, 200); pe.Font = this.Font; lock (stayed) { // 중복되는 항목 처리 foreach (var a in stayed) { if (a.Article.Title == pe.Article.Title) { pe.Article.Title += " " + pe.Article.Magic; break; } } stayed.Add(pe); } AddPe(pe); IncrementProgressBarValue(); Application.DoEvents(); }
private void CallbackThumbnail(object sender, AsyncCompletedEventArgs e) { PicElement pe = new PicElement(this); Tuple <string, HitomiArticle> tuple = (Tuple <string, HitomiArticle>)e.UserState; pe.Article = tuple.Item2; pe.Label = tuple.Item2.Title; pe.Dock = DockStyle.Bottom; pe.SetImageFromAddress(tuple.Item1, 150, 200); pe.SetToolTip(tooltip); pe.SetContextMenuStrip(ctxMenu); pe.Font = this.Font; pe.MouseEnter += Thumbnail_MouseEnter; pe.MouseLeave += Thumbnail_MouseLeave; pe.MouseClick += Thunbnail_MouseClick; pe.MouseDoubleClick += Thunbnail_MouseDoubleClick; lock (stayed) { // 중복되는 항목 처리 foreach (var a in stayed) { if (a.Article.Title == pe.Article.Title) { pe.Article.Title += " " + pe.Article.Magic; break; } } stayed.Add(pe); } lock (ImagePanel) ImagePanel.Controls.Add(pe); Application.DoEvents(); }