private void GoDown() { if (controllerControlling == "keyboard") { try { if (curentLine == 1) { line1[curentRow].BackColor = Color.FromArgb(30, 30, 30); } else if (curentLine == 2) { line2[curentRow].BackColor = Color.FromArgb(30, 30, 30); } else if (curentLine == 3) { line3[curentRow].BackColor = Color.FromArgb(30, 30, 30); } if (curentLine + 1 > 3) { curentLine = 1; } else { curentLine++; } if (curentLine == 1) { line1[curentRow].BackColor = Color.FromArgb(10, 10, 10); curentLetter = line1[curentRow].Text; } else if (curentLine == 2) { line2[curentRow].BackColor = Color.FromArgb(10, 10, 10); curentLetter = line2[curentRow].Text; } else if (curentLine == 3) { line3[curentRow].BackColor = Color.FromArgb(10, 10, 10); curentLetter = line3[curentRow].Text; } } catch { } } else if (controllerControlling == "youtubeSearchSelection") { if (curentVideoSearchLine + 1 < videoSearchResultsOnDisplay.Count) { videoSearchResultsOnDisplay[curentVideoSearchLine][curentVideoSearchRow].BackColor = Color.FromArgb(50, 50, 50); VideoVisual curent = videoSearchResultsOnDisplay[curentVideoSearchLine + 1][curentVideoSearchRow]; curent.BackColor = Color.Blue; curentVideoSearchLine++; } } }
private void Vv_play(object sender, EventArgs e) { VideoVisual self = sender as VideoVisual; browser.Load(self.link + "?autoplay=1"); First.Start(); webBrowser.BringToFront(); webBrowser.Visible = true; }
private async void Search(string keyword) { videoSearchResultsOnDisplay.Clear(); flowLayoutPanel2.Controls.Clear(); curentVideoSearchLine = 0; curentVideoSearchRow = 0; bool first = true; int maxRows = 6; List <VideoVisual> curentLine = new List <VideoVisual>(); foreach (Video v in await new Search().Run(keyword)) { VideoVisual vv = new VideoVisual(); vv.title = v.Title; vv.author = v.Chanel; vv.thumbnail = v.Thumbnail; vv.link = v.Link; vv.play += Vv_play; if (first) { vv.BackColor = Color.Blue; first = false; } flowLayoutPanel2.Controls.Add(vv); curentLine.Add(vv); if (curentLine.Count >= maxRows) { videoSearchResultsOnDisplay.Add(new List <VideoVisual>(curentLine)); curentLine.Clear(); } } }