예제 #1
0
 private void UpdateShows()
 {
     //Config.ReloadConfig();
     Database db = new Database();
     db.ProcessingShow += new Database.ProcessingShowHandler(db_ProcessingShow);
     db.ShowsOnDiskToDatabase();
     GetShowsInvoke();
 }
예제 #2
0
        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();
            }
        }
예제 #3
0
 private void UpdateCache()
 {
     Database db = new Database();
     Thread thread = new Thread(db.GetTvDbUpdates);
     db.ProcessingShow += new Database.ProcessingShowHandler(db_ProcessingShow);
     thread.Name = "Update Cache Thread";
     thread.Start();
 }
예제 #4
0
        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();
            }
        }
예제 #5
0
        private void SyncThread()
        {
            try
            {
                //First Populate the Shows Table
                Database db = new Database();
                db.ProcessingShow += new Database.ProcessingShowHandler(db_ProcessingShow);
                db.ShowsOnDiskToDatabase();

                Stopwatch sw = Stopwatch.StartNew();

                Logger.Log("=====================================================================");
                Logger.Log("Starting {0} v{1} - Build Date: {2:D}", App.Name, App.Version, App.BuildDate);
                Logger.Log("Current System Time: {0}", DateTime.Now);
                Logger.Log("=====================================================================");

                Logger.DeleteLogs();

                var job = new SyncJob();
                job.DbChanged += new SyncJob.DatabaseChangedHandler(UpdateView);
                job.Start();

                sw.Stop();
                Logger.Log("=====================================================================");
                Logger.Log("Process successfully completed. Duration {0:f1}s", sw.Elapsed.TotalSeconds);
                Logger.Log("{0}", DateTime.Now);
            }
            catch (Exception ex)
            {
                Logger.Log("Error: {0}", ex.Message);
                Logger.Log(ex.ToString());
            }
        }
예제 #6
0
        private void getBannerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (objectListViewShows2.SelectedItems.Count != 1)
                return;

            long id = Convert.ToInt64(objectListViewShows2.SelectedItem.Text);
            int index = objectListViewShows2.SelectedIndex;

            using (SABSyncEntities sabSyncEntities = new SABSyncEntities())
            {
                var showId = (from s in sabSyncEntities.shows where s.id == id select s.id).FirstOrDefault();

                Database db = new Database();
                db.GetBanner(showId);

                objectListViewShows2.SelectedIndex = 0;
                objectListViewShows2.SelectedIndex = index;
            }
        }
예제 #7
0
 private void GetBannersAndUpdatesThread()
 {
     Database db = new Database();
     db.ProcessingShow += new Database.ProcessingShowHandler(db_ProcessingShow);
     db.GetBanners();
     db.GetTvDbUpdates();
 }
예제 #8
0
 private void GetBanners()
 {
     Database db = new Database();
     Thread thread = new Thread(db.GetBanners);
     thread.Name = "Get Banners Thread";
     thread.Start();
 }