private void toolStripMenuItemShows2_list_update_selected_Click(object sender, EventArgs e) { //Update selected shows (1+) using (SABSyncEntities sabSyncEntities = new SABSyncEntities()) { List<long?> seriesIdList = new List<long?>(); for (int i = 0 ; i < objectListViewShows2.SelectedItems.Count; i++) { int id = Convert.ToInt32(objectListViewShows2.SelectedItems[i].Text); var seriesId = (from s in sabSyncEntities.shows where s.id == id select s.tvdb_id).FirstOrDefault(); seriesIdList.Add(seriesId); } Database db = new Database(); Thread dbThread = new Thread(new ThreadStart(delegate { db.UpdateFromTvDb(seriesIdList); })); db.ProcessingShow += new Database.ProcessingShowHandler(db_ProcessingShow); dbThread.Name = "Update Cache Thread Forced (Selected)"; dbThread.Start(); } }
private void toolStripMenuItemShows2_list_update_all_Click(object sender, EventArgs e) { //Update all shows (Forced) using (SABSyncEntities sabSyncEntities = new SABSyncEntities()) { var seriesIds = from s in sabSyncEntities.shows select s.tvdb_id; List<long?> seriesIdList = seriesIds.ToList(); Database db = new Database(); Thread dbThread = new Thread(new ThreadStart(delegate { db.UpdateFromTvDb(seriesIdList); })); db.ProcessingShow += new Database.ProcessingShowHandler(db_ProcessingShow); dbThread.Name = "Update Cache Thread Forced (All)"; dbThread.Start(); } }