private void sourceComboBox_SelectedIndexChanged(object sender, EventArgs e) { resolutionComboBox.Items.Clear(); sortComboBox.Items.Clear(); switch (sourceComboBox.SelectedIndex) { case 0: this.Crawler = new InterfaceLiftWallpaperCrawler(); break; case 1: this.Crawler = new WallpaperStockWallpaperCrawler(); break; default: return; } resolutionComboBox.Items.AddRange(this.Crawler.GetResolutions()); sortComboBox.Items.AddRange(this.Crawler.GetSortOptions()); //Select the matching resolution if (resolutionComboBox.Items.Count > 0) { int resolutionIndex = resolutionComboBox.FindStringExact(string.Format("{0}x{1}", Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)); if (resolutionIndex > -1) { resolutionComboBox.SelectedIndex = resolutionIndex; } else { resolutionComboBox.SelectedIndex = 0; } } //Select the first sort order if (sortComboBox.Items.Count > 0) { sortComboBox.SelectedIndex = 0; } }
public DownloadQueue(WallpaperCrawler crawler) { imageQueue = new Queue<string>(); this.crawler = crawler; syncRoot = new object(); }