private void bgwFindYouTubeWindows_DoWork(object sender, DoWorkEventArgs e) { ThreadHelperClass.SetVisible(this, progressBar, true); // Stop Timer tmrUpdateCurrentlyPlaying.Enabled = false; ThreadHelperClass.SetEnabled(this, btnFindChromeWindows, false); ThreadHelperClass.SetText(this, btnFindChromeWindows, "Finding non-minimized Chrome windows with YouTube tabs..."); ThreadHelperClass.SetEnabled(this, btnSelectChromeWindow, false); ThreadHelperClass.SetText(this, btnSelectChromeWindow, "2. Select window from list above"); ThreadHelperClass.SetEnabled(this, btnStartStop, false); ThreadHelperClass.SetText(this, btnStartStop, "3. Start"); ThreadHelperClass.SetText(this, lblCurrentlyPlaying, "Stopped"); showTabTitles(); ThreadHelperClass.SetEnabled(this, btnFindChromeWindows, true); ThreadHelperClass.SetText(this, btnFindChromeWindows, "1. Find non-minimized Chrome windows with YouTube tabs"); if (youtubeWindows.Count > 0) { ThreadHelperClass.SetEnabled(this, btnSelectChromeWindow, true); } }
private void btnSelectChromeWindow_Click(object sender, EventArgs e) { if (lstYouTubeWindows.SelectedItem != null) { YoutubeWindow youtubeWindow = (YoutubeWindow)lstYouTubeWindows.SelectedItem; selectedYoutubeWindow = youtubeWindow.Clone(); ThreadHelperClass.SetEnabled(this, btnStartStop, true); MessageBox.Show("Selected: " + youtubeWindow.TabName + Environment.NewLine + Environment.NewLine + "If you close the selected window or move the YouTube tab into a different window, come back and start again from button #1.", "Selected Chrome Window", MessageBoxButtons.OK, MessageBoxIcon.Information); } }