Пример #1
0
    static void FeedDone(IAsyncResult ares)
    {
        AsyncResult a   = (AsyncResult)ares;
        ReadResult  res = null;

        try {
            res = ((ReadDelegate)a.AsyncDelegate).EndInvoke(ares);
        } catch {
            res = new ReadResult(UpdateStatus.Error);
        }

        if (disable_load)
        {
            return;
        }
        Blogger blogger = (Blogger)ares.AsyncState;

        blogger.Feed = res.Feed;
        blogger.UpdateFeed();
        if (res.Status == UpdateStatus.CachedButError)
        {
            blogger.Error = true;
        }
        Settings.Log("DONE {0}", blogger.RssUrl);
        lock (all) {
            loaded++;
            counters [(int)res.Status]++;
            if (loaded >= all.Length)
            {
                wait_handle.Set();
            }
            if (next >= all.Length)
            {
                return;
            }
            Blogger      b = all [next++];
            ReadDelegate d = new ReadDelegate(FeedCache.Read);
            d.BeginInvoke(b.Name, b.RssUrl, feed_done, b);
        }
    }