private void SetResultBox(int RunCount, JToken item) { VideoJson videoinfo = new VideoJson(); videoinfo.title = item["snippet"]["title"].ToString(); videoinfo.description = item["snippet"]["description"].ToString(); videoinfo.ThumbnailURL = item["snippet"]["thumbnails"]["default"]["url"].ToString(); videoinfo.kind = item["id"]["kind"].ToString(); if (videoinfo.kind == "youtube#video") { videoinfo.vidioid = item["id"]["videoId"].ToString(); } else if (videoinfo.kind == "youtube#channel") { videoinfo.vidioid = item["id"]["channelId"].ToString(); } videoinfo.publishedAt = item["snippet"]["publishedAt"].ToString(); videoinfo.publishedChannel = item["snippet"]["channelTitle"].ToString(); VideoArray.Add(videoinfo); //쓰레드에서 돌아가는 함수이므로 전역변수 접근은 지양해야함 SearchResultControl SRC = new SearchResultControl(videoinfo); SRC.JsonRes += new EventHandler(SetResJson); SRC.Location = new Point(0, RunCount * 110); //this.SearchResult.Controls.Add(SRC); ResultControlList.Add(SRC);//이거도 안좋긴한데 그래도 위치값은 인자로 받아오니까 괜찮을듯 아마? ThreadEnd.Signal(); }
public SearchResultControl(VideoJson info) { InitializeComponent(); this.Thumbnail.Load(info.ThumbnailURL); this.Title.Text = info.title; this.Description.Text = info.description; thumbNailurl = info.ThumbnailURL; title = info.title; description = info.description; publishedAt = info.publishedAt; channelid = info.publishedChannel; videoid = info.vidioid; kind = info.kind; if (!kind.Contains("video")) { this.Mp3DownloadButton.Dispose(); this.mp4DownloadButton.Dispose(); } DownloadProgressBar.Maximum = 99; DownloadProgressBar.Minimum = 0; DownloadProgressBar.Step = 1; DownloadProgressBar.Value = 0; }