Example #1
0
        private void ApplicationBarIconButton_Click(object sender, EventArgs e)
        {
            AppUtils.FlurryLog("Sync");

            if (is_syncing)
            {
                Dispatcher.BeginInvoke(() => { AppUtils.ToastPromptShow("阅FM", "当前已有同步任务"); });
                return;
            }
            is_syncing = true;

            Dispatcher.BeginInvoke(() => { AppUtils.ToastPromptShow("阅FM", "开始同步推荐文章到本地.."); });

            count = 0;

            apiManager.CacheArticleHandler += apiManager_CacheArticleHandler;
            if (llc != null)
            {
                llc.ForEach((item) =>
                {
                    var query = from article in APIManager.cacheArticle
                                where article.id == item.article_id
                                select article;

                    if (query.FirstOrDefault() == null)
                    {
                        apiManager.CacheArticle(item.article_id);
                    }
                    else
                    {
                        count++;
                    }
                });
            }
        }