コード例 #1
0
        /// <summary>
        /// Does the update.
        /// </summary>
        public void Update()
        {
            InProgress = true;

            var i   = 0d;
            var cnt = Database.TVShows.Values.Count(s => s.Airing);
            var ids = Database.TVShows.Values.Where(s => s.Airing).OrderBy(s => s.Title).Select(s => s.ID).ToList();

            foreach (var id in ids)
            {
                UpdateProgressChanged.Fire(this, Database.TVShows[id].Title, ++i / cnt * 100);

                var tv = Database.Update(Database.TVShows[id], (e, s) =>
                {
                    if (e == -1)
                    {
                        UpdateError.Fire(this, s, null, true, false);
                    }
                });

                if (tv != null && tv.Language == "en")
                {
                    UpdateRemoteCache(tv);
                }
            }

            Database.Setting("update", DateTime.Now.ToUnixTimestamp().ToString());
            MainWindow.Active.DataChanged();
            UpdateDone.Fire(this);

            InProgress = false;
        }
コード例 #2
0
 public void OnUpdateDone(TEntity entity)
 {
     UpdateDone?.Invoke(entity);
     OperationDone?.Invoke(entity, Operation.Update);
 }